gpt4 book ai didi

Eclipse 中的 Python 错误 : SyntaxError: future feature print_function is not defined

转载 作者:太空宇宙 更新时间:2023-11-03 18:21:47 27 4
gpt4 key购买 nike

我正在尝试让 python 在 Eclipse 中与我一起工作。我确实下载了 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 future import。

如果您升级到Jython 2.7 Beta 2我打赌这个问题将会得到解决

关于Eclipse 中的 Python 错误 : SyntaxError: future feature print_function is not defined,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23974686/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com