After searching for a while, I stumbled into the answer for the py update part, at least.

The py command is an executable included with Windows Python distributions starting with Python v3.3. It is called the "Python Launcher for Windows" in the official Python documentation.

  • Note: An official py command is not included with Linux Python distributions, though there is the Py Launcher for Unix available for Linux that can be installed separately and works like the Windows version.

The documentation on the Python Launcher is pretty complete, but to answer my original question, I had set the environment variable PY_PYTHON to 3.7 to declare the default Python version for py to use.

I was able to fix the issue by updating this to 3.8 and restarting any terminal and program that uses a terminal to access py/python. There are other Python environment variables so I updated them all:

UPDATE: I was able to completely remove the PYTHONHOME and PYTHONPATH variables and just use PY_PYTHON to control the default version. You can read more about these variables in the Environment Variables section of the Python Documentation

  • set PY_PYTHON to 3.8
  • set PYTHONHOME to my new Python38 directory
  • for PYTHONPATH added the new python38 and python38/scripts directories.

Note: After updating environment variables, you will need to restart some programs, and others might require either a logout or full reboot (was true of VS Code on Windows).


More info on py command and versions

You can get a list of basic py commands using py --help:

$ py --help
Python Launcher for Windows Version 3.8.150.1013

usage:
C:\WINDOWS\py.exe [launcher-args] [python-args] script [script-args]

Launcher arguments:

-2     : Launch the latest Python 2.x version
-3     : Launch the latest Python 3.x version
-X.Y   : Launch the specified Python version
     The above all default to 64 bit if a matching 64 bit python is present.
-X.Y-32: Launch the specified 32bit Python version
-X-32  : Launch the latest 32bit Python X version
-X.Y-64: Launch the specified 64bit Python version
-X-64  : Launch the latest 64bit Python X version
-0  --list       : List the available pythons
-0p --list-paths : List with paths

The version strings above used to launch a particular version of python are what can be put into the PY_PYTHON environment variable. For example, if you just wanted the latest Python3, then use 3, for a particular Python3, use 3.8, or for the 32-bit version, use 3.8-32, etc.

Answer from LightCC on Stack Overflow
🌐
Python Central
pythoncentral.io › how-to-update-python
How to Update Python | Python Central
February 5, 2025 - You can specify which version of ... in commands (like “py -3.6”). In other words, you won’t need to change the PATH variable every time you want to use another version of Python. But the launcher only comes installed on the Windows version of Python 3. Updating Python in ...
🌐
Python
docs.python.org › 3 › using › windows.html
4. Using Python on Windows — Python 3.15.2 documentation
For all scenarios involving multiple runtime versions, the recommended command is py. This may be used anywhere in place of python or the older py.exe launcher. By default, py matches the behaviour of python, but also allows command line options to select a specific version as well as subcommands to manage installations.
Discussions

upgrade - Python update - how to update `py` to point to new version? - Stack Overflow
If I open up a new Command Window ... how do I update py to point to the latest version? Are there any other considerations with respect to virtual environments? They should remain pointing to the version of python they were built with - is that true of both python and py when a venv is active? Note: py is a command-line python launcher tool included ... More on stackoverflow.com
🌐 stackoverflow.com
Can you update Python on Windows from the command line?
There's a paragraph on that page aptly titled "4.1.3. Installing Without UI" More on reddit.com
🌐 r/learnpython
4
3
January 11, 2022
How do I upgrade the Python installation in Windows 10? - Stack Overflow
I have a Python 2.7.11 installed on one of my LAB stations. I would like to upgrade Python to at least 3.5. How should I do that ? Should I prefer to completely uninstall 2.7.11 and than install t... More on stackoverflow.com
🌐 stackoverflow.com
Windows: is it possible to update Python to the latest version when there's no binary installer?
According to the release calendar specified in PEP 619, Python 3.10 is now in the "security fixes only" stage of its life cycle: 3.10 branch only accepts security fixes and releases of those are made irregularly in source-only form until October 2026. Python 3.10 isn't receiving regular bug fixes anymore, and binary installers are no longer provided for it. Python 3.10.11 was the last full bugfix release of Python 3.10 with binary installers. From here You'll have to build it from source if you really want this specific version. Is there any reason you can't just use 3.12.6 though? That's the latest version. More on reddit.com
🌐 r/learnpython
15
3
September 11, 2024
🌐
Mimo
mimo.org › tutorials › python › how-to-update-python
How to Update Python
What you might do: update Python, then keep using an existing .venv. Why it breaks: the venv references an older interpreter and can include packages built for that older version. Fix: recreate the venv and reinstall dependencies. ... # delete the old .venv folder, then: python -m venv .venv # activate it, then: python -m pip install -r requirements.txt · If you see python: command not found, use python3 --version instead.
Top answer
1 of 1
2

After searching for a while, I stumbled into the answer for the py update part, at least.

The py command is an executable included with Windows Python distributions starting with Python v3.3. It is called the "Python Launcher for Windows" in the official Python documentation.

  • Note: An official py command is not included with Linux Python distributions, though there is the Py Launcher for Unix available for Linux that can be installed separately and works like the Windows version.

The documentation on the Python Launcher is pretty complete, but to answer my original question, I had set the environment variable PY_PYTHON to 3.7 to declare the default Python version for py to use.

I was able to fix the issue by updating this to 3.8 and restarting any terminal and program that uses a terminal to access py/python. There are other Python environment variables so I updated them all:

UPDATE: I was able to completely remove the PYTHONHOME and PYTHONPATH variables and just use PY_PYTHON to control the default version. You can read more about these variables in the Environment Variables section of the Python Documentation

  • set PY_PYTHON to 3.8
  • set PYTHONHOME to my new Python38 directory
  • for PYTHONPATH added the new python38 and python38/scripts directories.

Note: After updating environment variables, you will need to restart some programs, and others might require either a logout or full reboot (was true of VS Code on Windows).


More info on py command and versions

You can get a list of basic py commands using py --help:

$ py --help
Python Launcher for Windows Version 3.8.150.1013

usage:
C:\WINDOWS\py.exe [launcher-args] [python-args] script [script-args]

Launcher arguments:

-2     : Launch the latest Python 2.x version
-3     : Launch the latest Python 3.x version
-X.Y   : Launch the specified Python version
     The above all default to 64 bit if a matching 64 bit python is present.
-X.Y-32: Launch the specified 32bit Python version
-X-32  : Launch the latest 32bit Python X version
-X.Y-64: Launch the specified 64bit Python version
-X-64  : Launch the latest 64bit Python X version
-0  --list       : List the available pythons
-0p --list-paths : List with paths

The version strings above used to launch a particular version of python are what can be put into the PY_PYTHON environment variable. For example, if you just wanted the latest Python3, then use 3, for a particular Python3, use 3.8, or for the 32-bit version, use 3.8-32, etc.

🌐
Tabby Data
tabbydata.com › home › how can i update python using command prompt (cmd)?
How Can I Update Python Using Command Prompt (CMD)?
December 24, 2025 - The Python Launcher for Windows (py) simplifies managing multiple Python versions and can help in upgrading: Run py -0p to list all installed Python versions and their paths. Download and run the latest installer as described above. Invoke a specific Python version in cmd using py -3.x to test ...
🌐
Reddit
reddit.com › r/learnpython › can you update python on windows from the command line?
r/learnpython on Reddit: Can you update Python on Windows from the command line?
January 11, 2022 -

Is it possible to install or update Python system-wide through a command in CMD, Powershell, or WSL2 Bash like on Linux?

The full Python launcher installation executable file at https://docs.python.org/3/using/windows.html looks very large and spread out, compared to the single package in Unix / Linux

🌐
Cheap Windows VPS
cheapwindowsvps.com › blog › how-to-upgrade-python-on-windows-a-comprehensive-guide
How to Upgrade Python on Windows: A Comprehensive Guide - Cheap Windows VPS
January 20, 2025 - As discussed earlier, initiating the new Python interpreter is as easy as running the py command. By default, the launcher chooses the topmost Python version it can locate on your system.
Find elsewhere
🌐
InfoWorld
infoworld.com › home › software development › programming languages › python
How to use Python’s py launcher for Windows | InfoWorld
July 19, 2023 - The py launcher—or just py for short—is a shortcut to all the installed versions of Python on your system. With a command-line switch, you can see at a glance all the Python interpreters you’ve installed and then invoke a specific version, whether it’s 32-bit or 64-bit.
Top answer
1 of 10
180

Every minor version of Python, that is any 3.x and 2.x version, will install side-by-side with other versions on your computer. Only patch versions will upgrade existing installations.

So if you want to keep your installed Python 2.7 around, then just let it and install a new version using the installer. If you want to get rid of Python 2.7, you can uninstall it before or after installing a newer version—there is no difference to this.

Current Python 3 installations come with the py.exe launcher, which by default is installed into the system directory. This makes it available from the PATH, so you can automatically run it from any shell just by using py instead of python as the command. This avoids you having to put the current Python installation into PATH yourself. That way, you can easily have multiple Python installations side-by-side without them interfering with each other. When running, just use py script.py instead of python script.py to use the launcher. You can also specify a version using for example py -3 or py -3.6 to launch a specific version, otherwise the launcher will use the current default (which will usually be the latest 3.x).

Using the launcher, you can also run Python 2 scripts (which are often syntax incompatible to Python 3), if you decide to keep your Python 2.7 installation. Just use py -2 script.py to launch a script.


As for PyPI packages, every Python installation comes with its own folder where modules are installed into. So if you install a new version and you want to use modules you installed for a previous version, you will have to install them first for the new version. Current versions of the installer also offer you to install pip; it’s enabled by default, so you already have pip for every installation. Unless you explicitly add a Python installation to the PATH, you cannot just use pip though. Luckily, you can also simply use the py.exe launcher for this: py -m pip runs pip. So for example to install Beautiful Soup for Python 3.6, you could run py -3.6 -m pip install beautifulsoup4.

2 of 10
148

If you are upgrading any 3.x.y to 3.x.z (patch) Python version, just go to Python downloads page get the latest version and start the installation. Since you already have Python installed on your machine installer will prompt you for "Upgrade Now". Click on that button and it will replace the existing version with a new one. You also will have to restart a computer after installation.

If you are upgrading from 3.x to 3.y (minor) then you will be prompted with "Install Now". In this case, you are not upgrading, but you are installing a new version of Python. You can have more than one version installed on your machine. They will be located in different directories. When you have more than one Python version on your machine you will need to use py lanucher to launch a specific version of Python.

For instance:

py -3.7

or

py -3.8

Make sure you have py launcher installed on your machine. It will be installed automatically if you are using default settings of windows installer. You can always check it if you click on "Customize installation" link on the installation window.

If you have several Python versions installed on your machine and you have a project that is using the previous version of Python using virtual environment e.g. (venv) you can upgrade Python just in that venv using:

python -m venv --upgrade "your virtual environment path"

For instance, I have Python 3.7 in my ./venv virtual environment and I would like upgrade venv to Python 3.8, I would do following

python -m venv --upgrade ./venv

🌐
4Geeks
4geeks.com › en › how-to › how-to-update-python-in-terminal
How to Update Python in Terminal (Mac, Linux, Windows)
July 16, 2025 - Short answer: To update Python in the terminal, the command depends on your operating system. On Linux, run sudo apt update and sudo apt install python3.11, then set the default with sudo update-alternatives --config python3. On macOS, run brew ...
🌐
Microsoft Learn
learn.microsoft.com › en-us › windows › dev-environment › python
Python on Windows for beginners | Microsoft Learn
September 14, 2026 - You can also use commands like py -3.7 to select a particular version, or py --list to see which versions can be used. HOWEVER, the py.exe launcher will only work if you are using a version of Python installed from python.org. When you install Python from the Microsoft Store, the py command is not included.
🌐
YouTube
youtube.com › jacksphotoandtech
How To Upgrade Python on Windows - YouTube
How To Upgrade Python on WindowsSometimes we all need a little help understanding how to upgrade from one software package to another. This video will help y...
Published: August 11, 2021
Views: 27K
🌐
RunxBuild
runxbuild.com › home › blog › how to update python without breaking the version your system depends on
How to Update Python Without Breaking the Version Your System Depends On
July 18, 2026 - Tick Add Python to PATH if you want the new one on your command line. Minor versions (3.11, 3.12, 3.13) live side by side deliberately, because a project pinned to 3.11 should not be dragged to 3.12 without you deciding to. Use the py launcher to pick between them:
🌐
GeeksforGeeks
geeksforgeeks.org › python › how-to-update-python-on-windows
How to update Python on Windows? - GeeksforGeeks
July 23, 2025 - In this article, we are going to see how to update Python in the Windows system. For the sake of example, we will be upgrading from Python 3.6.8 to Python 3.9.6. Here, we will see how to upgrade the Python version. To check the current version of Python on your system, use the following command in the command prompt:
🌐
Command Linux
commandlinux.com › home › how to › how to update python on linux, windows, and mac
How to Update Python on Linux, Windows, and Mac
June 13, 2026 - Run python -m pip install –upgrade pip right after updating Python to pull the latest pip release on top of the new interpreter. Can I keep multiple Python versions on the same system?
🌐
4Geeks
4geeks.com › en › how-to › how-to-update-python-version
How to Update Python (Windows, Mac & Linux)
September 8, 2026 - # On windows Powershell $ choco upgrade python -y # MacOs homebrew with pyenv # you would need to install pyenv first $ pyenv install 3.9.2 # linux $ sudo add-apt-repository ppa:deadsnakes/ppa $ sudo apt update $ sudo apt install python3.9 · ...
🌐
CodeRivers
coderivers.org › blog › update-python-command-line
Updating Python on the Command Line: A Comprehensive Guide - CodeRivers
February 22, 2026 - Keeping Python up-to-date on your system is crucial as it brings various benefits, such as security improvements, performance enhancements, and access to the latest language features. This blog post will explore how to update Python on the command line across different operating systems, covering fundamental concepts, usage methods, common practices, and best practices.
🌐
PhoenixNAP
phoenixnap.com › home › kb › sysadmin › how to update python on windows, linux, and mac
How to Update Python on Windows, Linux, and Mac
March 12, 2026 - The output should show the latest version of Python, as in the image below. Chocolatey is a command-line package manager for Windows. Follow the steps below to update Python using Chocolatey:
🌐
4sysops
4sysops.com › home › articles › upgrade python in windows
Upgrade Python in Windows – 4sysops
February 20, 2024 - Chocolatey is a third-party package manager that makes installing many applications from the command line easy. If you already have Chocolatey installed, installing Python is as simple as executing the one-liner below in an elevated terminal window. ... The -y switch completes the execution without further user interaction. Chocolatey’s Python installation installs the launcher alongside.
🌐
YouTube
youtube.com › watch
How to Update Python via CMD in 2026 Step-by-Step Guide! - YouTube
**How to Update Python via CMD in 2025 (Step-by-Step Guide!)** 🚀 Want to upgrade Python to the latest version? In this quick tutorial, I'll show you how to...
Published: February 26, 2025