Use pip with Python 3.5

I have a AWS Ubuntu instance where I manually installed Python3.5 (downloaded it, configured, and ran make, make install). Then I changed the symbolic link

sudo ln -fs /opt/python3.5/bin/python3.5 /usr/bin/python3

But then when I try to run pip:

ubuntu@xxx:/dev$ pip -V
pip 8.1.1 from /usr/local/lib/python2.7/dist-packages/pip-8.1.1-py2.7.egg (python 2.7)

How can I fix this? Don't I need pip to be working with Python3? Should I have done anything differently? Thanks!


Solution 1:

You need to install pip3.

sudo apt-get install python3-pip should do it.

Then use pip3 -V

Solution 2:

I had to go through a slightly different procedure to get this working (Ubuntu 14.04--a local machine, not AWS). I think the difference may be that you were upgrading from 2.7 to 3.5, whereas I was updating from 3.4 to 3.5. I installed python3.5 through apt-get, then easy_install using curl, and finally pip using easy_install.

$ sudo apt-get install python3.5 python3.5-dev
$ sudo curl https://bootstrap.pypa.io/ez_setup.py -o - | sudo python3.5
$ sudo easy_install pip

Success!

$ pip3 -V
pip 1.5.4 from /usr/lib/python3/dist-packages (python 3.5)

As they say, it's turtles--or package managers--all the way down.