嗨,我正在尝试使用Pyinstaller生成.exe文件,请参见下面的代码:
import os
from stanza.server import CoreNLPClient
os.environ['CORENLP_HOME'] = r"C:\Users\user\source\repos\stanzing\stanford-corenlp-4.0.0"
text = 'hello Twitter'
client = CoreNLPClient(annotators=['tokenize','ssplit','pos','lemma','ner'], timeout=30000, memory='4G', endpoint='http://localhost:X')
client.start()
ann = client.annotate(text)
print(ann)
当我执行“ pyinstaller stanzing.py”并且Pyinstaller完成生成.exe文件时,我运行它并得到以下错误:
File "stanzing.py", line 2, in <module>
File "c:\users\user\my_env\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
class CExtensionImporter(object):
File "lib\site-packages\stanza\__init__.py", line 1, in <module>
File "c:\users\user\my_env\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
class CExtensionImporter(object):
File "lib\site-packages\stanza\pipeline\core.py", line 8, in <module>
File "c:\users\user\my_env\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
class CExtensionImporter(object):
File "lib\site-packages\torch\__init__.py", line 136, in <module>
ImportError: numpy.core.multiarray failed to import
[2412] Failed to execute script stanzing
我正在使用:
谢谢。