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 ...
- 166,664
- 26
- 169
- 251
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.
- 54,758
- 12
- 108
- 124
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.
- 3,219
- 3
- 19
- 38
- 13,318
- 4
- 46
- 48