I have two versions of python installed on my machine (Ubuntu 14.xx LTE) as well as two versions of pip (one for python 2 and one for python 3). When I run pip --version on the command line I get the following output: pip 1.5.4 from /usr/lib/python2.7/dist-packages (python 2.7). I looked into this directory and it has many other things in it. However I couldn't find pip.py in it. How do I run pip for python 3? Any help is appreciated.
2 Answers
To use another version of pip for python on ubuntu, you can use the python major version after pip. For Example:
pip --version
will return the default version of pip
pip2 --version
will use the Python 2 version of pip, and
pip3 --version
will use Python 3.
Hope this helped!
1 Comment
Alex Huszagh
Also, you can access pip as a module for different OSes easily for different Python installs. "/path/to/python/executable -m pip --version" works great for Windows versions with multiple Python installs, or if the Python variable is added to the path, then "python2 -m pip" and "python3 -m pip".
pip3pip3. But you also may provide full path to it like/usr/lib/python3.4/bin/pip/usr/bin/pip2script might have#!/usr/bin/python<- with just "python" and no specific version. Then it will launch the default Python, which is 3 nowadays. So, edit it to#!/usr/bin/python2.7or whatever Python 2 you have.