ModuleNotFoundError: No module named ‘fastText‘

29 篇文章 7 订阅
2 篇文章 0 订阅

1、确保安装过此包

安装命令为:

pip install fastText

2、我遇到的问题是安装成功,但是import仍然找不到

具体问题如下:

(nlp) ***@*****:/home2/**/NLPLearn/codes/chatservice$ pip install fastText
Requirement already satisfied: fastText in /home/***/anaconda3/envs/nlp/lib/python3.7/site-packages (0.9.2)
Requirement already satisfied: setuptools>=0.7.0 in /home/***/anaconda3/envs/nlp/lib/python3.7/site-packages (from fastText) (52.0.0.post20210125)
Requirement already satisfied: pybind11>=2.2 in /home/***/anaconda3/envs/nlp/lib/python3.7/site-packages (from fastText) (2.6.2)
Requirement already satisfied: numpy in /home/***/anaconda3/envs/nlp/lib/python3.7/site-packages (from fastText) (1.19.2)
(nlp) ***@*****:/home2/***/NLPLearn/codes/chatservice$ python test_classify.py 
Traceback (most recent call last):
  File "test_classify.py", line 4, in <module>
    from classify.build_model import prepar_model,test_model
  File "/home2/***/NLPLearn/codes/chatservice/classify/build_model.py", line 4, in <module>
    import fastText
ModuleNotFoundError: No module named 'fastText'

解决如下:

在fastText==0.9.0以后import时就改为小写。即:

import fastText
# 改为
import fasttext

详情见:https://github.com/facebookresearch/fastText/issues/474

 

  • 3
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
根据引用的信息,发生了一个ModuleNotFoundError错误,错误信息为"No module named 'fastText'"。引用中提到,你需要确保已经正确安装了fastText,并使用正确的导入语句。你可以尝试使用以下命令安装fastText: ``` git clone https://github.com/facebookresearch/fastText.git cd fastText python setup.py install ``` 另外,引用中提到,在fastText的0.9.0版本后,导入时应该使用小写的"fasttext",而不是"fastText"。你可以尝试将导入语句改为`import fasttext`,或者`from fasttext import FastText`,而不是`import FastText`。这样应该能够解决ModuleNotFoundError的问题。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *3* [ModuleNotFoundError: No module namedfastText](https://blog.csdn.net/longshaonihaoa/article/details/115604883)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *2* [解决报错ModuleNotFoundError: No module namedfastText](https://blog.csdn.net/weixin_35757704/article/details/119884779)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值