【问题标题】:Unable to import nonsense from Nostril无法从 Nostril 导入废话
【发布时间】:2022-12-03 10:40:34
【问题描述】:

我正在尝试从 Nostril 导入废话( from nostril import nonsense) 但我得到这个错误;

ImportError                               Traceback (most recent call last)
Cell In [12], line 1
----> 1 from nostril import nonsense

ImportError: cannot import name 'nonsense' from 'nostril' (c:\Users\GithuaG\AppData\Local\Programs\Python\Python310\lib\site-packages\nostril\__init__.py)

这是什么在里面.py 文件包含:

 from .__version__ import __version__, __title__, __url__, __description__
from .__version__ import __author__, __email__
from .__version__ import __license__, __copyright__

from .ng import NGramData
from .nonsense_detector import (
    nonsense, generate_nonsense_detector, test_unlabeled, test_labeled,
    ngrams, dataset_from_pickle, sanitize_string
)

尝试在网络上进行研究但没有成功。 任何帮助将不胜感激,谢谢

【问题讨论】:

    标签: python


    【解决方案1】:

    你很可能在安装你需要的实际鼻孔包之前做了pip install nostril(就像我做的那样)。这会导致同时安装另一个用于测试的包。您可以卸载两个 nostril 包,然后只重新安装您需要的 nostril 包。

    或者,如果您需要这两个包,您可以直接从 nonsense_detector 中导入 nonsense 对象,如下所示

    from nostril.nonsense_detector import nonsense
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-09-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-01-07
      • 1970-01-01
      • 2012-11-09
      • 1970-01-01
      相关资源
      最近更新 更多