我试图和我一起在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
我该如何解决?
最佳答案
仅python 2.7+具有将来的print_function导入。
如果您升级到Jython 2.7 Beta 2,我敢肯定,这个问题将会解决