ModuleNotFoundError: 没有名为“fasttext”的模块

Ash*_*'Sa 7 python anaconda conda fasttext

我尝试fasttext使用两个渠道通过 conda安装:

conda install -c conda-forge fasttext

conda install -c conda-forge/label/cf201901 fasttext

根据(https://anaconda.org/conda-forge/fasttext)。

我正在使用以下命令导入:import fasttext 但是,导入失败并显示错误:

ModuleNotFoundError Traceback (最近一次调用最后一次) in ----> 1 import fasttext

ModuleNotFoundError: 没有名为“fasttext”的模块

但是,尝试以较旧的方式导入它import fastText,但失败了。

已经尝试过的pythonpython3,这两者的失败。

我想避免使用安装它pip并使用conda.

conda list显示fasttext正在安装。其输出如下所示:

fasttext 0.2.0 hfc679d8_1 conda-forge/label/cf201901

的输出python -c 'import sys; print(sys.path)如下:

['', '/<dir>/<dir>/anaconda3/lib/python37.zip', '/<dir>/<dir>/anaconda3/lib/python3.7', '/<dir>/<dir>/anaconda3/lib/python3.7/lib-dynload', '/<dir>/<dir>/anaconda3/lib/python3.7/site-packages']

Sor*_*dan 5

我以这种方式使用fastText :

!git clone https://github.com/facebookresearch/fastText.git
!cd fastText
!pip install fastText
import fasttext.util
fasttext.util.download_model('en', if_exists='ignore')  # English
model = fasttext.load_model('cc.en.300.bin')
Run Code Online (Sandbox Code Playgroud)

注1:注意大写字母。

注 2:是支持的语言列表。