How can a Windows program detect Python installations?

53 views Asked by At

I am trying to determine how a given Windows application locates and loads the Python installation it's going to use.

Some context : I have Python 3.12 installed on my system (for my own programming). But I also have a Windows application installed, named "DaVinci Resolve", which needs Python 3.6 in order to offer a certain functionality.

Problem: That application keeps detecting and loading Python 3.12.

Please note that it succeeds in loading Python 3.12, which is a good thing because then I can run some commands to check sys.path and platform.python_version() . The issues only arise later, when I try to use that certain functionality I was mentionning (it's a scripting API. It requires Python 3.6). That API is the whole point of using that application, it's my end goal. Don't let it distract you, if you want the full story you can find it here : https://forum.blackmagicdesign.com/viewtopic.php?f=12&t=168568&p=1009509#p1009509

I'm giving you the short version of my attempts:

  • If %PATH% only contains Python 3.6 then the application still loads Python 3.12 (I've verified by starting the application from a command prompt where I echo %PATH% before, and also do print(sys.path) from with the application after startup. Both show only python36)

  • If I "hide" the folder containing Python 3.12 (by renaming it temporarily) then the application says that Python is not installed on the system. If it was merely scanning the folders then it would still detect Python 3.6!

Hence the question : What are the standard-ish ways used by a Windows application to locate Python installations on the system?

  • PATH is out of the way, as demonstrated
  • I'm not looking for completely custom (goofy) methods, only standard methods that I might not know but that experienced Python users might know.
0

There are 0 answers