"py.ini" question
Barry Scott
barry at barrys-emacs.org
Sat Apr 24 14:01:27 EDT 2021
> On 24 Apr 2021, at 15:23, Gisle Vanem <gisle.vanem at gmail.com> wrote:
>
> I have a question about the Python launcher;
> c:\Windows\py.exe and the py.ini file.
>
> I have both Python 3.6 (32-bit) and Python 3.8 (64-bit)
> installed. And I have a 'c:\Users\Gisle\AppData\Local\py.ini'
> with this only:
> [defaults]
> python=3.6
>
> A copy of this is also in 'c:\Windows\py.ini'.
> So when I do a:
> py -3 -c "import sys; print(sys.version)"
>
> I would assume a "3.6..." would be printed.
> But no, py.exe chooses to run my newest Python 3.8:
> 3.8.9 (default, Apr 13 2021, 15:54:59) [GCC 10.2.0 64 bit (AMD64)]
>
> Only when I do 'py -3.6 -c ...', I get what I'd expect.
>
> So is a 'py.ini' and the '[defaults]' simply ignored
> or is my syntax wrong?
You can find out what py.exe is using for its config by running:
py -0
The entry with an * at the end is the default.
On windows 10 your personal py.ini is in %localappdata%\py.ini
do you have one?
type %localappdata%\py.ini
If not you might want to create one that sets things up as you need them configured.
Here is what I have on my windows 10:
C:\Users\barry>py -0
Installed Pythons found by py Launcher for Windows
-3.10-64
-3.10-32
-3.9-64 *
-3.9-32
-3.8-64
-3.8-32
-3.7-64
-3.7-32
-3.6-64
-3.6-32
-3.5-64
-3.5-32
-3.4-64
-3.4-32
-2.7-64
-2.7-32
C:\Users\barry>type %localappdata%\py.ini
[defaults]
python=3.9-64
python3=3.9-64
C:\Users\barry>py
Python 3.9.4 (tags/v3.9.4:1f2e308, Apr 6 2021, 13:40:21) [MSC v.1928 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
Barry
>
> --
> --gv
> --
> https://mail.python.org/mailman/listinfo/python-list
>
More information about the Python-list
mailing list