Alternatively, since pip itself is written in python, you can just call it with the python version you want to install the package for:

Copypython2.7 -m pip install foo
Answer from Turion on Stack Overflow
Discussions

Is it possible to install Pip for older versions of Python?
I’ve found out how to use older versions of Python by installing them using dnf install python3.x. But how can I install Pip for them? When I install python-pip, I get pip, pip-3, and pip-3.11, but how can I get e.g. pip-3.9? Specifically, I want to use the Taichi language, which is available ... More on discussion.fedoraproject.org
🌐 discussion.fedoraproject.org
3
0
February 27, 2023
How do I choose what python version pip installs packages to.
You should work the other way around, as pip is a component of a python environment. It's not a standalone installer tool. Meaning the pip you launch by default is one of the many environments and thus probably not the one your want. Instead you should first activate your specific environment, then run pip from it, eg path/to/venv> activate your venv path/to/venv> python -m pip install etc More on reddit.com
🌐 r/learnpython
8
7
May 31, 2023
Are python packages tied to a specific python version?
Yes, python packages are installed in site-packages directory, which is tied to a specific python installation. If you want to install packages for a specific pyhon installation use python3.9 -m pip install requests, or even better setup a venv for each project. More on reddit.com
🌐 r/learnpython
10
2
November 1, 2022
How to install with pip directly from GitHub?
Option 3 is what i would've classed Official, however I use Option 1 all the time. Easier to remember to put /zipball/master at the end then anything else. More on reddit.com
🌐 r/Python
12
37
August 6, 2014
🌐
Python Packaging
packaging.python.org › tutorials › installing-packages
Installing Packages - Python Packaging User Guide
In this case, this means to install any version “==1.4.*” version that’s also “>=1.4.2”. pip can install from either Source Distributions (sdist) or Wheels, but if both are present on PyPI, pip will prefer a compatible wheel. You can override pip`s default behavior by e.g.
🌐
pip
pip.pypa.io › en › stable › installation
Installation - pip documentation v26.1.2
If you face issues when using Python and pip installed using these mechanisms, it is recommended to request for support from the relevant provider (eg: Linux distro community, cloud provider support channels, etc). ... Windows, Linux and macOS. CPython 3.10, 3.11, 3.12, 3.13, 3.14 and latest PyPy3. pip is tested to work on the latest patch version of the Python interpreter, for each of the minor versions listed above.
Find elsewhere
🌐
Built In
builtin.com › articles › pip-install-specific-version
Pip Install a Specific Version: A Guide | Built In
Uninstall and Install Method: First, run pip uninstall <package_name>, then execute pip install <package_name>==<version>. Overwrite Method: Install the specific Python package and add --ignore installed to overwrite the previous version.
🌐
PyPI
pypi.org › project › pip
pip · PyPI
3 weeks ago - You can use pip to install packages from the Python Package Index and other indexes. Please take a look at our documentation for how to install and use pip: ... We release updates regularly, with a new version every 3 months.
      » pip install pip
    
Published   May 31, 2026
Version   26.1.2
🌐
Codidact
software.codidact.com › posts › 291675
Installing packages for, and using them with, a specific Python installation - Software Development
June 14, 2024 - When I use Pip to install something from PyPI, I find that only one Python installation can use the code. Worse, the installation chosen by pip isn't necessarily the Python chosen by python. Why don't (can't?) my Python installations share libraries? How do I choose one as the "target" for a Pip installation? ... The short version of the answer is: Python installations don't normally share libraries because there are too many ways it could go wrong; generally each installation has its own install locations for third-party libraries; and generally each Python installation also gets its own copy of Pip, which is designed to install for that Python installation.
🌐
Python
docs.python.org › 3 › installing › index.html
Installing Python modules — Python 3.14.6 documentation
On Linux, macOS, and other POSIX systems, use the versioned Python commands in combination with the -m switch to run the appropriate copy of pip: python3 -m pip install SomePackage # default Python 3 python3.14 -m pip install SomePackage # ...
🌐
MTU Service Desk
servicedesk.mtu.edu › TDClient › KB › ArticleDet
Installing, uninstalling, or upgrading Python modules using Pip (Linux)
Python and Pip can be run using the python[VERSION] and pip[VERSION] commands, where the version is inserted after “python” or “pip”. For instance, to run the default version of Python 3, the python3 command will have to be used.
🌐
W3Schools
w3schools.com › python › python_pip.asp
Python PIP
Note: If you have Python version 3.4 or later, PIP is included by default. A package contains all the files you need for a module. Modules are Python code libraries you can include in your project. Navigate your command line to the location of Python's script directory, and type the following: ... If you do not have PIP installed, you can download and install it from this page: https://pypi.org/project/pip/
🌐
YouTube
youtube.com › watch
How to install pip for a specific python version - YouTube
python: How to install pip for a specific python versionThanks for taking the time to learn more. In this video I'll go through your question, provide variou...
Published   July 2, 2023
🌐
Astral
docs.astral.sh › uv › concepts › python-versions
Python versions | uv
March 18, 2026 - In some cases, uv allows using a Python version from a virtual environment. In this case, the virtual environment's interpreter will be checked for compatibility with the request before searching for an installation as described above. See the pip-compatible virtual environment discovery documentation for details. When performing discovery, non-executable files will be ignored. Each discovered executable is queried for metadata to ensure it meets the requested Python version.
🌐
pip
pip.pypa.io › en › stable › cli › pip_download
pip download - pip documentation v26.1.2
Download a package and all of its dependencies with OSX specific interpreter constraints. This forces OSX 10.10 or lower compatibility. Since OSX deps are forward compatible, this will also match macosx_10_9_x86_64, macosx_10_8_x86_64, macosx_10_8_intel, etc. It will also match deps with platform any. Also force the interpreter version to 27 (or more generic, i.e. 2) and implementation to cp (or more generic, i.e. py). ... python -m pip download \ --only-binary=:all: \ --platform macosx_10_10_x86_64 \ --python-version 27 \ --implementation cp \ SomePackage Windows
🌐
YouTube
youtube.com › the code city
How to Install Specific Version of a Module Using PIP (2024) - YouTube
In this video, I'll show you how you can install a specific version of a python module using PIP.PIP is a very popular dependency installer for python, and w...
Published   March 31, 2024
Views   191
🌐
Fedora Discussion
discussion.fedoraproject.org › ask fedora
Is it possible to install Pip for older versions of Python? - Fedora Discussion
February 27, 2023 - I’ve found out how to use older versions of Python by installing them using dnf install python3.x. But how can I install Pip for them? When I install python-pip, I get pip, pip-3, and pip-3.11, but how can I get e.g. pip-3.9? Specifically, I want to use the Taichi language, which is available for Py…
🌐
Pierian Training
pieriantraining.com › home › tutorial: how to pip install a specific version of a python library
Tutorial: How to Pip Install a Specific Version of a Python Library - Pierian Training
April 27, 2023 - Once you have Python installed, pip can be installed using the command line interface by typing “pip install pip”. Pip comes with several useful features that make it a great tool for managing package dependencies in your projects.
🌐
Squash
squash.io › how-to-install-specific-package-version-with-pip-in-python
How to Install Specific Package Versions With Pip in Python
November 2, 2023 - Here's the command to install a specific version of a package using pip: ... Replace package_name with the name of the package you want to install and desired_version with the version number you want to install.