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'
subprocess.devnull
是Python 3.3中的新增功能。
确保使用nltk
stil支持Python 2.7的版本。从他们的变更日志中:
Version 3.5 2019-10-16
* drop support for Python 2
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句