我正在尝试运行用python 2编写的脚本(通过udacity课程测验)。该课程说明建议使用python 2.6或2.7,因此我在
对于Anaconda提示,我得到了这个提示:
(py2)C:\ Users \ fayolpc \ Desktop \ ml-mini-project \ ud120-projects> python tools / startup.py
checking for nltk
Traceback (most recent call last):
File "tools/startup.py", line 6, in <module>
import nltk
File "C:\PYTHON\envs\py2\lib\site-packages\nltk\__init__.py", line 128, in <module>
from nltk.collocations import *
File "C:\PYTHON\envs\py2\lib\site-packages\nltk\collocations.py", line 35, in <module>
from nltk.probability import FreqDist
File "C:\PYTHON\envs\py2\lib\site-packages\nltk\probability.py", line 333
print("%*s" % (width, samples[i]), end=" ")
^
SyntaxError: invalid syntax
对于原子编辑器,我得到了:
File "C:\Users\fayolpc\Desktop\ml-mini-project\ud120-projects\tools\startup.py", line 4
print "checking for nltk"
^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print("checking for nltk")?
我不知道问题出在哪里,我已经做了很多寻找解决方案的工作,但找不到任何解决方法。如果有人可以帮助我,我将不胜感激。顺便说一下,我是编程和这个社区的新手。感谢您考虑提供帮助。