你如何在py2exe中包含子进程?

时间:2016-03-26 16:17:58

标签: python subprocess py2exe

当我使用py2exe将程序打包到exe中并尝试运行它时,它会返回以下内容:

Traceback (most recent call last):
  File "raman_utility_v1.0.2.pyw", line 386, in <module>
  File "raman_utility_v1.0.2.pyw", line 132, in __init__
  File "raman_utility_v1.0.2.pyw", line 136, in getHome
  File "subprocess.pyc", line 566, in check_output
  File "subprocess.pyc", line 710, in __init__
  File "subprocess.pyc", line 958, in _execute_child
WindowsError: [Error 2] The system cannot find the file specified

目前我的setup.py看起来像这样:

from distutils.core import setup
import py2exe

setup(
    options={
        "py2exe" : {"includes" : ["sip","subprocess"]}
    },
    windows=[{
        "script" : "raman_utility_v1.0.2.pyw"
    }]
)

要运行setup.py,我运行以下cmd:

python setup.py py2exe --includes sip

我尝试将子进程添加到cmd中,如下所示:

python setup.py py2exe --includes sip,subprocess

但所有这一切都是打破啜饮。

我尝试将subprocess.pyc文件复制到dist文件夹中,但这不起作用。我尝试的最后一件事是来自py2exe not including the modules from "includes"的建议,即使用“packages”而不是“includes”(用于子进程)。这并没有改变任何事情。我也尝试添加这一行:

import subprocess

在setup.py的开头但是没有改变任何东西

我是否走在正确的轨道上?你有任何提示都会非常有帮助!

0 个答案:

没有答案