How to Install Pip for a Specific Python Version

Install a module using pip for specific python version

Use a version of pip installed against the Python instance you want to install new packages to.

In many distributions, there may be separate python2.6-pip and python2.7-pip packages, invoked with binary names such as pip-2.6 and pip-2.7. If pip is not packaged in your distribution for the desired target, you might look for a setuptools or easyinstall package, or use virtualenv (which will always include pip in a generated environment).

pip's website includes installation instructions, if you can't find anything within your distribution.

Install pip for specific python version

Some Python distributions may not come with pip installed. Try

python3.9 -m ensurepip

to install pip for your interpreter first.

How to install pip with specific python version?

Pip is itself a package, and you can specify a version when installing pip:

python -m pip install pip==9.0.1

Note that that is quite an old pip, and you may have problems.

At to getting python 3.6---you will have to install it yourself; there's probably a package. Make your virtual env first, and then fix the pip version. I've not used 3.6 for a long time, but I imagine this worked back then:

python3.6 -m venv venv
source venv/bin/activate.sh
# we are now in the venv
python -m pip install pip==9.0.1

How to install pip packages to specific Python version?

On Linux the @jwodder answer is fine, but on Windows use the Python Launcher, which is normally installed by default. You specify the version of Python to launch as -X.Y, e.g.:

py -3.6 -m pip install ...

How to install a package for specific python version

python -m pip install package

python3 -m pip install package

This is how you would do it using pip for v2 and v4 respectively.



Related Topics



Leave a reply



Submit