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
Replace Single Quote With Double Quote in a String Python
How to Restart a Program Based on User Input
How to Delete Tkinter Widgets from a Window
Use Variable as Key Name in Python Dictionary
Making a Matrix in Python 3 Without Numpy Using Inputs
Passing Multiple Arguments from Django Template Href Link to View
Find the Item With Maximum Occurrences in a List
Python Convert Comma Separated List to Pandas Dataframe
Python: How to Find the First Day of Every Month Between Two Date Ranges
Regular Expression to Check Whitespace in the Beginning and End of a String
Python Db-Api: Fetchone VS Fetchmany VS Fetchall
Pandas Dataframe Calculations With Previous Row
How to Remove Hashtag, @User, Link of a Tweet Using Regular Expression
How to Remove Empty Cell from Data Frame Row Wise
How to Ask a Set of Questions Multiple Times Based on User Input
How to Stop a Running Function Without Exiting the Tkinter Window Entirely
The Right Way to Limit Maximum Number of Threads Running At Once