I upgraded my Ubuntu server from 15.04 to 16.04 LTS recently. In the process, Python 3.5 was installed. However, the version of pip3 that comes with it apparently wants to use python 3.4 for some reason, not python 3.5.

Here's the error that I see:

-bash: /usr/local/bin/pip3: /usr/bin/python3.4: bad interpreter: No such file or directory

How can I install the appropriate version of pip to work with my python 3.5 install?

Here are the python packages I have installed (found via sudo apt list --installed | grep python):

dh-python/xenial-updates,xenial-updates,now 2.20151103ubuntu1.1 all [installed,automatic]
libpython-stdlib/xenial,now 2.7.11-1 amd64 [installed]
libpython2.7/xenial-updates,xenial-security,now 2.7.12-1ubuntu0~16.04.1 amd64 [installed]
libpython2.7-minimal/xenial-updates,xenial-security,now 2.7.12-1ubuntu0~16.04.1 amd64 [installed]
libpython2.7-stdlib/xenial-updates,xenial-security,now 2.7.12-1ubuntu0~16.04.1 amd64 [installed]
libpython3-stdlib/xenial,now 3.5.1-3 amd64 [installed]
libpython3.5/xenial-updates,xenial-security,now 3.5.2-2ubuntu0~16.04.1 amd64 [installed,automatic]
libpython3.5-minimal/xenial-updates,xenial-security,now 3.5.2-2ubuntu0~16.04.1 amd64 [installed,automatic]
libpython3.5-stdlib/xenial-updates,xenial-security,now 3.5.2-2ubuntu0~16.04.1 amd64 [installed,automatic]
python/xenial,now 2.7.11-1 amd64 [installed]
python-apt/xenial,now 1.1.0~beta1build1 amd64 [installed]
python-apt-common/xenial,xenial,now 1.1.0~beta1build1 all [installed]
python-attr/xenial,xenial,now 15.2.0-1 all [installed,automatic]
python-cffi-backend/xenial,now 1.5.2-1ubuntu1 amd64 [installed,automatic]
python-characteristic/xenial,xenial,now 14.3.0-1 all [installed]
python-chardet/xenial,xenial,now 2.3.0-2 all [installed]
python-configobj/xenial,xenial,now 5.0.6-2 all [installed]
python-cryptography/xenial-updates,xenial-security,now 1.2.3-1ubuntu0.1 amd64 [installed,automatic]
python-debian/xenial,xenial,now 0.1.27ubuntu2 all [installed]
python-enum34/xenial,xenial,now 1.1.2-1 all [installed,automatic]
python-gdbm/xenial,now 2.7.11-2 amd64 [installed]
python-idna/xenial,xenial,now 2.0-3 all [installed]
python-ipaddress/xenial,xenial,now 1.0.16-1 all [installed,automatic]
python-minimal/xenial,now 2.7.11-1 amd64 [installed]
python-openssl/xenial,xenial,now 0.15.1-2build1 all [installed]
python-pam/xenial,now 0.4.2-13.2ubuntu2 amd64 [installed]
python-pkg-resources/xenial,xenial,now 20.7.0-1 all [installed]
python-pyasn1/xenial,xenial,now 0.1.9-1 all [installed]
python-pyasn1-modules/xenial,xenial,now 0.0.7-0.1 all [installed]
python-serial/xenial,xenial,now 3.0.1-1 all [installed]
python-service-identity/xenial,xenial,now 16.0.0-2 all [installed]
python-six/xenial,xenial,now 1.10.0-3 all [installed]
python-twisted-bin/xenial,now 16.0.0-1 amd64 [installed]
python-twisted-core/xenial,xenial,now 16.0.0-1 all [installed]
python-zope.interface/xenial,now 4.1.3-1build1 amd64 [installed]
python2.7/xenial-updates,xenial-security,now 2.7.12-1ubuntu0~16.04.1 amd64 [installed]
python2.7-minimal/xenial-updates,xenial-security,now 2.7.12-1ubuntu0~16.04.1 amd64 [installed]
python3/xenial,now 3.5.1-3 amd64 [installed]
python3-minimal/xenial,now 3.5.1-3 amd64 [installed,automatic]
python3.5/xenial-updates,xenial-security,now 3.5.2-2ubuntu0~16.04.1 amd64 [installed,automatic]
python3.5-minimal/xenial-updates,xenial-security,now 3.5.2-2ubuntu0~16.04.1 amd64 [installed,automatic]
  • 1
    You can update pip.... Using pip! sudo pip install -U pip – grooveplex May 26 '17 at 15:19

I downloaded the get-pip.py script, and ran it with python3.5. Doing that seemed to clear things up.

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.