I have Python 3.7 and Python 3.6. How to I chose to which version of Python I want my PIP packages?
4 Answers
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 ...
- 148,243
- 22
- 160
- 229
You use the version of pip that corresponds to the desired Python version. The most universally effective way is to run pythonX.Y -m pip install ..., where X.Y is replaced with the Python version number, though running just pipX.Y install ... may also work under some circumstances.
- 50,627
- 10
- 99
- 112
I would suggest to use the newer and (now) recommended way of installing Python application dependencies: pipenv. You can consider pipenv to be the better pip (pip + virtualenv handling + proper depedency management). Using pipenv you create a Pipfile and you can specify the exact python_version you want to use in that file. Since I started using pipenv in my projects most headaches I had previously with Python dependency and version management are gone.
- 2,991
- 3
- 17
- 34
- 12,832
- 4
- 42
- 47