Reputation: 41
I am creating a setup from C# program successfully with Inno Setup. To run this program I need Python. Until today I asked my customers to install Python manually, since some customers are not always following my installation guide, I am getting often questions from them. Now I want to simplify the installation, so that everything is done automatically. I need to set:
C:\Python\Python3.5.2
C:\Python\Python3.5.2
I tried to do this with this code, but I didn't had any success. Normal Python installation is starting unfortunately.
[Run]
Filename: "{app}\deploy\python-3.5.2.exe"; \
Parameters: "/i ""C:\Python\Python-3.5.2"" /qb! ALLUSER=1 ADDLOCAL=ALL"; \
WorkingDir: "{app}\deploy"; Flags: 32bit; Check: python_is_installed
[Code]
function python_is_installed() : Boolean;
var
key : string;
begin
{ check registry }
key := 'software\Python\Python-3.5.2\InstallPath';
Result := not RegValueExists(HKEY_LOCAL_MACHINE, Key, '');
end;
What do I do wrong?
BR Stefan
Upvotes: 3
Views: 3467
Reputation: 1356
Another problem is that the installation check in the code section is not working as expected. RegValueExists()
always returns false with an empty value name. That means your check function always returns false even if the key exists. This is the reason why Python installation is run always, even if Python is already installed.
To check for the existence of a key, not a value, use the function RegKeyExists()
.
See How to check if specific Python version is installed in Inno Setup?
Upvotes: 1
Reputation: 202642
You seem to be using a completely wrong sent of command line arguments (for Windows Installer?).
See Python documentation for correct command-line arguments of the Python Windows installer:
https://docs.python.org/3/using/windows.html
You probably want something like this:
/passive InstallAllUsers=1 TargetDir=C:\Python\Python3.5.2 PrependPath=1
Upvotes: 1