在Inno Setup中运行已安装的Python脚本时获取“Process exit code:2”

时间:2017-04-21 09:20:08

标签: python inno-setup

如何在Inno Setup中运行Python setup.py libraries?我的意思是哪个部分是正确的地方,怎么办?通常,在终端中,以下语法有效

python setup.py install

但是,以下代码无法在Inno Setup [Run]部分中使用。 我收到“退出代码2”

[Run]
Filename: "{app}\python.exe"; Parameters: "{app}\requests-master\setup.py install"; \
    WorkingDir: "{app}"; Flags: waituntilterminated

日志信息如下:

[12:21:24.240] -- Run entry -- 
[12:21:24.241] Run as: Current user 
[12:21:24.242] Type: Exec 
[12:21:24.243] Filename: msiexec.exe 
[12:21:24.246] Parameters: /i "C:\Program Files (x86)\Project\python-3.4.3.msi" TARGETDIR="C:\Program Files (x86)\Project\Python34" /passive 
[12:21:24.955] Process exit code: 0 
[12:21:24.971] -- Run entry -- 
[12:21:24.972] Run as: Current user 
[12:21:24.987] Type: Exec 
[12:21:24.988] Filename: C:\Program Files (x86)\Project\Python34\python.exe 
[12:21:24.989] Parameters: C:\Program Files (x86)\Project\waitress-master\setup.py install 
[12:21:25.113] Process exit code: 2

任何指针对我都有帮助。

1 个答案:

答案 0 :(得分:1)

由于{app}路径(C:\Program Files (x86))包含空格,您必须将其换成双引号(并且必须double them to escape them in the Inno Setup script,它自己使用双引号) :

[Run]
Filename: "{app}\python.exe"; Parameters: """{app}\requests-master\setup.py"" install"; \
    WorkingDir: "{app}"; Flags: waituntilterminated