【发布时间】:2016-07-03 21:12:33
【问题描述】:
我已经成功安装了 nltk from this site。只是为了验证我能够从终端导入它。但是当我从 Spyder 执行我的 python 脚本时,它会在 Spyders 终端中出现以下错误
File "/Prateek/Python/RC_ISSUES/algorithm_RC.py", line 9, in <module>
import nltk
ImportError: No module named nltk
以下输出来自终端
我知道可能会有类似的问题,但我认为它与其他问题不同
【问题讨论】:
-
您是否检查过 spyders 使用的 python 与您从命令行调用的 python 相同?也许它有它自己的,或者需要指向系统python。
-
我是python的初学者,请问如何检查它是否指向系统python?。
-
在
algorithm_RC.py中的import nltk之前将这一行:import sys; print sys.version添加到您的代码中 -
@alvas,它显示
2.7.10 (default, Jun 1 2015, 09:45:55) [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] -
瞧,不同的版本,一个在
Oct 23 2015上编译,另一个在Jun 1 2015=)
标签: python macos python-2.7 nltk spyder