0

I have Python 3.11.4 installed and at the very start of my PATH variable. I also have Python 2.7.15 installed because GIMP depends on it for extensions. I want to use Python 3 instead of Python 2 in Command Prompt, but python -V returns 2.7. Weirdly enough, py boots into the 3.11.4 REPL.

PS C:\Users\Haley> py
Python 3.11.4 (tags/v3.11.4:d2340ef, Jun  7 2023, 05:45:37) [MSC v.1934 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
KeyboardInterrupt
>>> quit()
PS C:\Users\Haley> python -V
Python 2.7.15

How can I reconfigure my Command Prompt or Windows install to use Python 3.11.4 all across the board?

4
  • 1
    Aside from previous questions, please read the relevant documentation for the py command in order to understand what it is doing differently from python. The short version is that py is always one specific program that is always on the PATH, and uses its own logic to choose an installed Python. Using python means that the PATH needs to be searched and whichever Python appears first on the path (if any) is the one that gets used - just like for any other executable name at the command prompt. Commented Jul 22, 2023 at 8:31
  • (Aside from that, consider whether you really still need 2.7 on your computer - since it's a Windows machine, the operating system won't depend on it, and it's very outdated now - comparable to Windows 7.) Commented Jul 22, 2023 at 8:32
  • Always good to keep one (latest), @KarlKnechtel has given the solution. But you can uninstall the 2.7 version and other and reinstall fresh python that you want. Commented Jun 19 at 12:33
  • @KarlKnechtel “I also have Python 2.7.15 installed because GIMP depends on it for extensions.” Commented Jul 2 at 23:27

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.