From: "Fred L. Drake, Jr."
Thomas Heller writes:
There is a Windows api to find out which pythonxx.dll python.exe binds to, so it should be possible.
Cool! So there is hope for people who build from source but don't or can't build the installer. (Wise was generous in giving us a copy of their current installer builder, but it was only one license.)
I have implemented most of this. The user can browse for other python.exe files, and the installer determines the dll which this exe loads. The final problem is that I'm not able to figure out sys.prefix for this executable. I tried to dynamically embed this dll, and retrieve sys.prefix. Normally this is empty. If I do not set PYTHONHOME, sys.prefix is wrong (the path to the installer executable). If I do set PYTHONHOME to the actual python.exe, sys.prefix is also wrong (path to the python.exe). In case I've compiled my python from source, the path to the exe is ...\src\PCBUILD\python.exe, and sys.prefix is set to ...\src\PYBUILD while it should be '...\src'. sys.path seems to be set correctly. The only possibility I see at the moment is to import the os module, retrieve the path from it (which is <prefix>/lib/os.py), and determine the prefix from it. Aren't there any other solutions? Thomas