Eclipse中的Python错误:SyntaxError: future feature print_function



我正试图在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我打赌这个问题将会解决

相关内容

  • 没有找到相关文章

最新更新