Configuring the Python (py) Launcher in Windows7/10 to launch a specific version via ini file

On Windows7/10, you can have several versions of Python installed and start them with the py launcher.

To start the latest Python 3, the command is py -3 <your file>

If you want to change the behaviour, to have py -3 start a different version,the docs say that you can place a py.ini file somewhere to change this.

Two .ini files will be searched by the launcher - py.ini in the current user’s “application data” directory (i.e. the directory returned by calling the Windows function SHGetFolderPath with CSIDL_LOCAL_APPDATA) and py.ini in the same directory as the launcher. The same .ini files are used for both the ‘console’ version of the launcher (i.e. py.exe) and for the ‘windows’ version (i.e. pyw.exe).

I'm failing to translate that into a real name of a path name where I could put the py.ini file.

I've tried "c:\Users\ my_username " and "c:\Users\ my_username \AppData\Roaming"

After installing Python 3.8 next to 3.7 I'd like to globally keep the py launcher to still default to 3.7

Any help?

1 Answer

It was "c:\Users\ my_username \AppData\Local".

From this stackoverflow question solution, slightly modified.

The two lines code to run are

from win32com.shell import shell, shellcon
print(shell.SHGetFolderPath(0, shellcon.CSIDL_LOCAL_APPDATA, None, 0))

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like