How to Install an Older Version of Python
Install an older version of Python alongside your current installation, then explicitly select it when creating your project’s virtual environment. On Windows and macOS, use the installer for the required release from Python.org; on Linux, a separate source build lets you keep the system’s Python unchanged. The important distinction is that installing an interpreter, selecting it, and installing its packages are separate tasks.
Understand What You Need to Downgrade
Installing another Python release does not automatically select it for your terminal, your project, or your package installations.
Before downloading anything, identify which part of your setup needs to change:
- Python interpreter: The runtime that executes your code.
- Python package: A dependency installed with pip, such as NumPy.
- Virtual environment: A project-specific environment created from an already-installed interpreter.
For example, a project that requires an earlier Python release needs that interpreter installed first. Installing an older package with pip does not downgrade Python.
Also distinguish between a major/minor requirement and an exact patch requirement. If the project accepts any patch release in its required Python series, choose the newest compatible patch. If you must reproduce an exact release, match the complete version.
Keep your existing installation unless you have a specific reason to remove it. In particular, do not replace a Linux distribution’s system Python or redirect its system Python symlinks: operating-system tools may depend on that installation.
How to Install an Older Python Version Safely
The commands below use Python 3.14 as an example selected interpreter. Replace that version with your project’s required major/minor version, and confirm that the corresponding interpreter is installed.
Step 1: Check the Project Requirement and Existing Installations
- Look for the required Python version in the project’s README,
.python-versionfile,pyproject.toml, CI configuration, or deployment configuration. Inpyproject.toml, the relevant field is commonlyrequires-python. - Check what is already installed.
On Windows, use the Python launcher to list installed runtimes and their locations:
py -0p
On Linux or macOS, check the interpreter currently selected by your shell:
python3 --version
That POSIX command shows the current default, not every installed Python. A separately installed version may already be available through its versioned executable.
- If the required runtime is already installed, use it to create a new project environment rather than reinstalling it.
The table matches each operating system and release-file situation to an installation route and a way to keep the runtime separate:
| Your Situation | Installation Route | How You Keep It Separate |
|---|---|---|
| Windows, with an installer available | Official Windows installer | Select the runtime through the Python launcher |
| macOS, with an installer available | Official macOS installer | Use the versioned Python executable |
| Linux, or an exact source release on a supported Unix setup | Build the official source archive | Install into a dedicated user-owned directory |
| Very old Python on a modern operating system | Check compatibility before installing | Use a compatible isolated environment rather than changing the host’s system Python |
Step 2: Download the Required Python Release
- Open the official Python downloads archive and find the required release.
- Open its release page and locate the Files section.
- Download the file that matches your operating system and architecture: – Windows: The appropriate Windows installer. – macOS: The macOS installer, if one is provided. – Source build: The XZ-compressed source tarball.
Check the release page’s operating-system requirements before running an old installer. An archived release is not necessarily compatible with a current operating system or processor.
Some maintenance releases provide source archives without Windows or macOS installers. A nearby release’s installer is not an exact substitute. If the project permits a different patch release, choose a compatible release with an installer; otherwise, you need a build or distribution of the exact required runtime.
Step 3: Install the Interpreter Alongside Your Existing Python
Windows Installer
- Run the downloaded installer.
- Keep pip selected. Enable the Python launcher if the installer offers it and it is not already installed.
- Review the PATH option. Older installers may label it Add Python 3.6 to path; the wording follows the selected release and appears on the installer’s first screen. Leave it unchecked if you want to preserve your current terminal default and select the older runtime through the launcher.
- Complete the installation, open a new Command Prompt, and verify the selected runtime:
py -3.14 --version
The result must match the version you intended to install. If the launcher is unavailable, enable it through an installer that provides it, or invoke the installed python.exe by its full path.
macOS Installer
- Open the downloaded
.pkgfile and complete the installer. - Open a new Terminal window.
- Verify the versioned interpreter:
python3.14 --version
If your shell cannot find it, check the installation directly. Locate the installed versioned Python executable, then run it by its full path with –version.
/Library/Frameworks/Python.framework/Versions/3.14/bin/python3.14 --version
Use that full executable path for project commands if the versioned command is unavailable through PATH.
Linux Source Build
The following dependency commands are for recent Debian- and Ubuntu-based distributions. Other distributions use different package names and package managers.
- Install the compiler and development libraries:
sudo apt update
sudo apt install build-essential pkg-config libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev libffi-dev liblzma-dev libncurses-dev libgdbm-dev libgdbm-compat-dev uuid-dev tk-dev libzstd-dev
- Put the downloaded XZ source archive in an otherwise empty working folder. Open a terminal in that folder, then extract it:
tar -xf Python-*.tar.xz
cd Python-*/
These wildcard commands assume the folder contains only one matching archive and extracted source directory.
- Configure a dedicated installation inside your home directory:
./configure --prefix="$HOME/.local/older-python" --with-ensurepip=install
The older-python directory is the destination for this runtime. Give subsequent separate installations their own destination directories.
- Build Python:
make
- Install it without replacing the default Python command:
make altinstall
Use the altinstall target rather than make install.
No sudo is needed for this installation because its destination is inside your home directory.
- Verify the installed executable:
"$HOME/.local/older-python/bin/python3.14" --version
Also check that important extension modules were built:
"$HOME/.local/older-python/bin/python3.14" -c "import ssl, sqlite3, bz2, lzma; print('Core extension imports OK')"
Do not continue with a build that reports missing modules your project needs. Install the relevant development libraries, rerun configuration and the build, reinstall with the alternative target, and repeat the import check.
Step 4: Create a Virtual Environment With the Selected Interpreter
- Open a terminal in your project directory.
- Check that the selected runtime provides the tools needed to create the environment.
On Windows, check pip and venv before relying on them for project setup:
py -3.14 -m pip --version
py -3.14 -m venv --help
A missing pip module does not mean the interpreter itself failed to install. However, resolve missing environment tooling before proceeding.
- Create a new environment using the intended interpreter.
On Windows:
py -3.14 -m venv .venv
On macOS, or a POSIX installation with a versioned executable on PATH:
python3.14 -m venv .venv
For the user-local Linux source installation:
"$HOME/.local/older-python/bin/python3.14" -m venv .venv
Use a fresh directory. If the project already contains an environment named .venv, preserve any dependency records and remove or rename that environment before creating its replacement.
- Activate the environment.
In Windows Command Prompt:
.venv\Scripts\activate.bat
In Bash or Zsh on Linux or macOS:
source .venv/bin/activate
Activation changes command selection in the current terminal session; it does not replace your system Python.
I use a Python virtual environment here because it keeps the project’s dependencies separate from other installations.
Step 5: Install Compatible Project Dependencies
With the environment activated, install the project’s recorded dependencies:
python -m pip install -r requirements.txt
Use that command only if the project provides a requirements.txt file. Otherwise, use the project’s documented dependency installation procedure.
To pin an individual package to an exact version:
python -m pip install "SomePackage==1.0.4"
Replace SomePackage and the example package version with the project’s actual dependency requirement. Package versions and Python interpreter versions are separate: the chosen package release must support the selected interpreter.
For direct installation into a separately managed runtime rather than an activated environment, target that runtime explicitly. The Python module-installation documentation provides this POSIX pattern:
python3.14 -m pip install SomePackage
On Windows, the equivalent is:
py -3.14 -m pip install SomePackage
Replace the version selector with the project’s required version and confirm the installed runtime. For a source-built interpreter outside PATH, use its full executable path instead of the versioned command.
Avoid bare pip commands when multiple interpreters are installed. Calling pip through Python binds the package operation to that interpreter.
Finally, verify the active environment:
python --version
python -m pip --version
The first result should show the intended runtime; the second should identify pip inside the project environment. Run the project’s documented startup command or tests to finish checking the installation.
Special Cases for Legacy Python and Raspberry Pi
Raspberry Pi Installations
On Raspberry Pi OS, keep the distribution-managed Python unchanged. A separate native source build can provide an older interpreter without replacing the runtime used by system tools.
Use a source archive rather than a Windows installer or a binary built for a different processor architecture. The build targets the operating system and architecture currently running on the Pi, which may differ from the hardware’s full capabilities.
For a Debian-based Raspberry Pi OS release, install the build dependencies and configure the source build with a dedicated destination inside your home directory. After installation, create the project environment with the new interpreter’s full executable path and verify the project before changing its service or launch configuration.
End-of-Life Python Releases
An end-of-life interpreter no longer receives normal security fixes. Prefer a supported release that satisfies the project’s requirements, and reserve unsupported releases for compatibility work that cannot yet be migrated.
Very old Python may also fail to build against modern compilers, OpenSSL, or other system libraries. Do not solve that by downgrading shared libraries across your host operating system. A compatible isolated operating-system environment is a better boundary for legacy work.
Python 2 projects need separate consideration: they do not provide the modern built-in venv workflow used in this article.
Legacy Distutils Instructions
The standard-library distutils package was removed in Python 3.12. Instructions based on it are not a general solution for installing either an interpreter or modern project dependencies.
Old installation guides may also assume obsolete versions of setuptools, pip, or a package’s build backend. Use the project’s compatible tool versions rather than automatically upgrading every packaging tool to its newest release.
Fix Common Older-Python Setup Problems
Common setup problems are resolved by selecting the intended interpreter, repairing its components, and using package releases compatible with the older runtime.
The Terminal Still Runs the Wrong Python
Check which executable is actually running:
python -c "import sys; print(sys.executable)"
If the location is not your intended environment, activate that environment or invoke the required interpreter by its full path.
An IDE can select a different interpreter from the terminal. Set the project interpreter to .venv\Scripts\python.exe on Windows or .venv/bin/python on Linux and macOS.
Pip Is Missing
If the intended interpreter has ensurepip, bootstrap pip through that interpreter:
python -m ensurepip --default-pip
Here, python must already resolve to the interpreter or environment you intend to repair. Otherwise, substitute the selected runtime’s full executable path.
Then confirm the repair:
python -m pip --version
If ensurepip is unavailable, use the installation method’s supported repair route. For a standard Windows installer, modify or repair the installation with pip enabled, then repeat the check.
Venv Is Missing or Environment Creation Fails
First, inspect the actual error. A missing venv module, a missing pip bootstrap component, and a permissions failure are different problems.
For a modern standard Python installation, repair or reinstall the selected runtime if its standard-library files are incomplete. For a distribution-managed interpreter, install that distribution’s matching virtual-environment support package.
After correcting the cause, create the environment again in a fresh directory. Activate it and verify both the Python version and pip location before installing dependencies.
An Interpreter Path Produces Permission Denied
An installation directory is not an executable. Tools that request a Python interpreter need the path to python.exe on Windows or the actual executable inside the installation’s bin directory on POSIX systems.
This distinction also matters with version managers: selecting the folder containing a runtime does not select the interpreter inside it. Correct the executable path before changing permissions.
A Package Cannot Be Installed on the Older Runtime
An error such as “No matching distribution found” can mean the requested package release does not support your Python version, operating system, or architecture.
Check the project’s dependency constraints and the package’s supported Python versions. Install a compatible package release rather than trying to force an incompatible wheel into the environment. If the project has a lockfile, preserve its version constraints unless you are deliberately updating the project.
Verify and Preserve the Working Python Setup
Before treating the installation as complete, inspect the interpreter from the terminal you will actually use:
python -c "import sys; print(sys.version); print(sys.executable); print(sys.prefix != sys.base_prefix)"
For a standard active virtual environment, the last value should be True.
Confirm these details:
- Runtime: The displayed version matches the project requirement, including the patch release when necessary.
- Executable: The path belongs to the intended project environment.
- Dependencies: pip identifies the environment, and required packages import successfully.
- Editor and automation: Your IDE, scheduled task, service, or CI job selects the intended interpreter.
Record the Python requirement in the project’s configuration and retain its dependency or lock files. Do not commit the virtual-environment directory itself.
Next, run the project’s normal test or startup command from that environment. A successful version check confirms interpreter selection; a successful project run confirms that the runtime and dependencies work together.
Start with its documented Python requirement and dependency records, then use the actual startup or test errors to identify remaining compatibility problems.
Frequently Asked Questions
Can I Install an Older Version of Python With Pip?
No. Pip installs Python packages, not the Python interpreter itself. Install the required runtime with an installer, version manager, or source build, then use that runtime to install its compatible packages.
Can I Downgrade Python Inside an Existing Virtual Environment?
Not reliably by changing a setting or installing a package. A virtual environment is created from a particular Python installation; install the required older interpreter and create a replacement environment from it. Reinstall the project’s dependencies rather than copying the old environment’s package directory.
Can I Keep Two Patch Releases of the Same Python Version on Windows?
Do not assume standard Windows installers will keep them as independent installations. Installers within the same major/minor series can update an existing installation or reject an older patch, and a major/minor launcher selector does not distinguish every patch release. Exact side-by-side patch requirements need separately managed runtimes selected by their full executable paths.
Will Installing Older Python Fix Every Legacy Project?
No. The project may also require compatible dependency versions, native libraries, or an older operating-system environment. Start with its documented Python requirement and dependency records, then run its startup command or tests to identify remaining compatibility problems.
