I have an inno set up code , which installs python . It works fine and I am getting the setup.exe file with the set up file having the python in it. But when I tried installing python with that setup file , it didnt work.Is that because the setup file is looking for the python file specified in the file section, If so How can I change the code so that the python inside the setup.exe will be used .Also the setup is creating a default application every time when I install the set up.I have tried the attribute DisableDirPage=yes ,but it didnt work. Can any body suggest some solution to this.
#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;
Installing Python Packages with Setup.py To install a package that includes a setup.py file, open a command or terminal window and: cd into the root directory where setup.py is located. Enter: python setup.py install.
Steps To Make Installer From .Step 1: Download inno setup software. Step 2: Choose Create new script file using the Script Wizard. Step 3: Fill Application Information. Step 4: Add files and folders and click on Next.
Made some changes to your script as Tlama said. Working fine at my side, Changed the File section entry and used Exec instead ShellExec...
replace python-2.7.5.amd64.msi to python-2.7.5.msi and replace D:\ to H:\
#define MyAppName "My Program"
#define MyAppVersion "1.5"
[Setup]
AppId={{BD59E856-F194-4E05-A93B-89089F3E3E9D}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
OutputBaseFilename=setup
Compression=lzma
SolidCompression=yes
DisableDirPage=yes
[Files]
Source: "D:\python-2.7.5.amd64.msi"; Flags: dontcopy
[code]
#define MinJRE "1.6"
function InitializeSetup: Boolean;
var
ErrorCode: Integer;
PythonInstalled: Boolean;
Result1: Boolean;
WebJRE: string;
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('This tool requires python Runtime Environment to run. Do you want to install it now ?', mbConfirmation, MB_YESNO) = IDYES;
if not Result1 then
begin
Result := False;
end
else
begin
MsgBox('not installed', mbInformation, MB_OK);
Result := True;
ExtractTemporaryFile('python-2.7.5.amd64.msi')
WebJRE:='"'+Expandconstant('{tmp}\python-2.7.5.amd64.msi')+'"'
Exec('cmd.exe ','/c'+WebJRE,'', SW_HIDE,ewWaituntilterminated, Errorcode);
end;
end;
end;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With