我尝试在InnoSetup生成的设置期间运行python脚本,但没有任何效果.代码部分结果代码中的运行部分或执行代码都不同,这取决于我调用它的方式.
当然,如果它不存在,我会在安装过程中安装Python.这是测试代码Inno
[Setup]
AppName=PyPy_client
AppVersion=0.1
DefaultDirName={pf}\DeployPyPy
UninstallDisplayIcon={app}\test.py
Compression = zip/1
OutputDir=deploy
SetupLogging = yes
UsePreviousGroup=False
DisableProgramGroupPage=yes
PrivilegesRequired = admin
[Files]
Source: "D:\Dev\deploy_python\python-3.3.2.msi"; DestDir: "{app}\deploy"; Flags: ignoreversion
Source: "D:\Dev\deploy_python\test.py"; DestDir: "{app}"; Flags: ignoreversion
[Run]
Filename: "msiexec"; Parameters: "/i ""{app}\deploy\python-3.3.2.msi"" /qb! ALLUSER=1 ADDLOCAL=ALL"; WorkingDir: "{app}\deploy"; Flags: 32bit; Check: python_is_installed
Filename: "cmd.exe"; Parameters: "/c{code:GetPythonPath}\python.exe {app}\test.py"; WorkingDir: "{app}"; Flags: waituntilterminated
[Code]
function python_is_installed() : Boolean;
var
key : string;
begin
//check registry
key := 'software\Python\PythonCore\3.3\InstallPath'
Result := not RegValueExists(HKEY_LOCAL_MACHINE,Key,'');
end;
function GetPythonPath(Param : String) …Run Code Online (Sandbox Code Playgroud)