How to set environment variable path of python using Inno script

How to set environment variable path of python using Inno script: I have Qt project in which I have used python and its different modules, but the problem is when I made a setup(EXE) for windows using Inno, then the application needs python dependency in the windows system. That means if a user had not installed python on the machine, the application would not run. So In order to run that application user must installed python and set environment variable path of python in the system. but at the user ends it is not expected that the user is aware of these things. A user only needs the application to be running in their system. It’s a programmer job to make application all dependency free Applications.

Must see: How to create a standalone EXE setup for python application projects

Inno Setup is a free Windows installer software. Building an installer involves writing a plain text script containing directions on what and where to install. It has many characteristics, including shortcuts for desktop and begins menu, post-install scripts, and so on. A wizard makes it easy and quick to get started.

Steps: How to set environment variable path of python using Inno script

1- Install Inno setup in your machine and run the program and create an Inno script. If you don’t know how to create an Inno script then watch this video. (very useful)

2- Now in Inno script make some changes. Your script should look like this.

Add this code in registry section. if you don’t have registry section then create one. ( This is for setting up python in Environment variable )

[Registry]

Root: HKCU; Subkey: "Environment"; ValueType:string; ValueName: "Path"; ValueData: "C:\Program Files (x86)\LyricPad\WPy64-3720\python-3.7.2.amd64"; Flags: preservestringtype

Note: Replace valueData path to your directory path

How to set environment variable path of python using Inno script registry setting
Ignore no.2 (this is for winpython)

Note: Ignore no 2 instruction in the above screenshot.(this is for Winpython)

Conclusion:

This solution works for me and is adaptive for me. But I don’t think this is the only method to do. if you have another method then you are free to do.

That’s all.. if you have a problem/doubt anywhere, then feel free to ask in the comments section.