我试过安装 fasttext
通过 conda 使用两个 channel :conda install -c conda-forge fasttext
和conda install -c conda-forge/label/cf201901 fasttext
按照 ( https://anaconda.org/conda-forge/fasttext )。
我使用以下命令导入:import fasttext
但是,导入失败并显示错误:
ModuleNotFoundError Traceback (most recent call last) in ----> 1 import fasttext
ModuleNotFoundError: No module named 'fasttext'
但是,尝试以较旧的方式导入它
import fastText
,失败了。试过
python
和 python3
,这两个都失败了。我想避免使用
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']
最佳答案
我用过 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')
注1:注意大写字母。注 2:Here是支持的语言列表。
关于python - ModuleNotFoundError : No module named 'fasttext' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58186800/