from nltk.parse.corenlp import CoreNLPServer
server = CoreNLPServer()
server.start()当我运行上面的代码时,我得到了以下错误。
Traceback (most recent call last):
File "server.py", line 30, in <module>
server.start()
File "/usr/local/lib/python2.7/dist-packages/nltk/parse/corenlp.py", line 130, in start
stderr=stderr,
File "/usr/local/lib/python2.7/dist-packages/nltk/internals.py", line 112, in java
subprocess_output_dict = {'pipe': subprocess.PIPE, 'stdout': subprocess.STDOUT, 'devnull': subprocess.DEVNULL}
AttributeError: 'module' object has no attribute 'DEVNULL'发布于 2019-11-26 06:24:06
subprocess.devnull是Python3.3中的新特性。
请确保您使用的nltk版本仍然支持Python2.7。来自their changelog
Version 3.5 2019-10-16
* drop support for Python 2https://stackoverflow.com/questions/59040636
复制相似问题