ImportError:numpy.core.multiarray无法导入pyinstaller Stanza

时间:2020-05-09 14:24:50

标签: python numpy pytorch pyinstaller stanford-stanza

嗨,我正在尝试使用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

我正在使用:

  1. 节1.0.1
  2. PyInstaller 3.6
  3. numpy 1.18.4
  4. 火炬1.5.0 + cpu

谢谢。

0 个答案:

没有答案