我正在尝试让Eclipse中的python工作。我确实下载了Pydev并编写了一个小的python代码。
我的python版本是:Python 2.7.6 在我的Mac OS X 10.9.2上
我现在收到的错误是(顺便说一句,我在使用Jython 2.5.4rc1和Python解释器时遇到此错误):
Traceback (most recent call last):
File "/Users/ha/EclipseProjects/PythonNLTK/Code.py", line 11, in <module>
import nltk
File "/Library/Python/2.7/site-packages/nltk/__init__.py", line 99, in <module>
from collocations import *
File "/Library/Python/2.7/site-packages/nltk/collocations.py", line 38, in <module>
from nltk.metrics import ContingencyMeasures, BigramAssocMeasures, TrigramAssocMeasures
File "/Library/Python/2.7/site-packages/nltk/metrics/__init__.py", line 23, in <module>
from nltk.metrics.segmentation import windowdiff, ghd, pk
File "/Library/Python/2.7/site-packages/nltk/metrics/segmentation.py", line 45, in <module>
import numpy
File "/Library/Python/2.7/site-packages/nltk/metrics/segmentation.py", line 45, in <module>
import numpy
File "/Library/Python/2.7/site-packages/numpy/__init__.py", line 107
SyntaxError: future feature print_function is not defined
我该如何解决?
答案 0 :(得分:1)
只有python 2.7+具有print_function的未来导入。
如果您升级到 Jython 2.7 Beta 2 ,我打赌这个问题将会解决