我有一个 inno 设置代码,它安装 python。它工作正常,我得到了setup.exe文件,其中包含 python 的设置文件。但是当我尝试使用该设置文件安装python时,它没有工作。那是因为安装文件正在寻找文件部分中指定的python文件,如果是这样我该如何更改代码以便setup.exe中的python将被使用。此外,每次我安装设置时,设置都会创建一个默认应用程序。我尝试了属性DisableDirPage=yes,但它没有用。任何机构都可以提出一些解决方案。
#define MyAppName "My Program"
#define MyAppVersion "1.5"
[Setup]
AppId={{BD59E856-F194-4E05-A93B-89089F3E3E9D}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
;AppPublisher={#MyAppPublisher}
;AppPublisherURL={#MyAppURL}
;AppSupportURL={#MyAppURL}
;AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
OutputBaseFilename=setup
Compression=lzma
SolidCompression=yes
DisableDirPage=yes
[Files]
Source: "H:\python-2.7.5.msi"; DestDir: "{app}"; Flags: ignoreversion
[code]
#define MinJRE "1.6"
#define WebJRE "H:\python-2.7.5.msi"
function InitializeSetup(): Boolean;
var
ErrorCode: Integer;
PythonInstalled : Boolean;
Result1 : Boolean;
begin
PythonInstalled := RegKeyExists(HKLM,'SOFTWARE\Wow6432Node\Python\PythonCore\2.7\InstallPath');
if PythonInstalled then
begin
MsgBox('installed', mbInformation, MB_OK);
end
else
begin
Result1 := MsgBox('2222222222222222This tool requires python Runtime Environment to run. Do you want to install it now?',
mbConfirmation, MB_YESNO) = idYes;
if Result1 = false then
begin
Result:=false;
end
else
begin
MsgBox('not installed', mbInformation, MB_OK);
Result:=true;
ShellExec('',
'{#WebJRE}',
'','',SW_SHOWNORMAL,ewNoWait,ErrorCode);
end;
end;
end;