为什么我的Pyinstaller exe在启动Java程序的其他计算机上失败?

时间:2019-04-02 14:50:21

标签: python subprocess pyinstaller

我已经实现了一些我想用作可执行文件的接口。
我用PyInstaller从我的.py

创建我的.exe。

我的.exe在我的计算机上运行良好。

但是当我尝试从另一台计算机运行它时,会得到以下结果:

E:\global_nice_interface>global_nice_interface.exe
E:\global_nice_interface\stanford-corenlp-full-2018-10-05
Traceback (most recent call last):
  File "global_nice_interface.py", line 58, in <module>
  File "Preprocessing\launch_server.py", line 18, in start_NLP_server
  File "subprocess.py", line 769, in __init__
  File "subprocess.py", line 1172, in _execute_child
FileNotFoundError: [WinError 2] Le fichier spécifié est introuvable
[11376] Failed to execute script global_nice_interface

我的代码中对应的行是:

subprocess.Popen('java -mx1g -cp "*" edu.stanford.nlp.pipeline.StanfordCoreNLPServer -port'+StanfordCoreNLP_port+' -tiemout 15000',cwd=StanfordCoreNLP_path)

变量StanfordCoreNLP_path和_port的定义如下:

StanfordCoreNLP_path = os.path.abspath('stanford-corenlp-full-2018-10-05')
StanfordCoreNLP_port = '9000'

我通过打印StanfordCoreNLP_path来检查它(“结果”的第二行):它对应于所需的目录...

我有点迷茫:我不知道该去哪里解决这个问题...

编辑:我不知道这是否重要,但是我在计算机上的配置和其他设备上的.exe是通过USB密钥(E:/)运行的。 >

1 个答案:

答案 0 :(得分:0)

在另一台计算机上安装java解决了我的问题。