0

I have installed Python 3.5.5 on my raspberry Pi 3 (Raspbian - jessie) following 2nd answer from this post. Python installed.
[EDIT]
but the installation folder is located in /home/pi/Python-3.5.5. So, question no.1: Is it a recommended place for it?
/home/pi/Python-3.5.5 is the remaining folder after installation
Number 2 is: There seems to be a problem with missing bits in /usr/bin.
The assumed missing bits are in /usr/local/bin
[/EDIT]

Because there are many python versions, I needed to do
update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1

later, i did
update-alternatives --install /usr/bin/python python /usr/bin/python3.4 2
so, now after typing

update-alternatives --list python 

I have:

/usr/bin/python2.7
/usr/bin/python3.4

which is fine. When I do:

python --version  

it tells me

Python 3.4.2

Fantastic, anyway I would like to run Python 3.5 as default, (there is no python3.5 file in /usr/bin) so I did:
[EDIT]

update-alternatives --install /usr/bin/python python /home/pi/Python-3.5.5/python 3   

This was done wrong way: as mentioned earlier /home/pi/Python-3.5.5/ is the remaining folder after installation. Instead, should be:

update-alternatives --install /usr/bin/python python /usr/local/bin/python3.5 3  

[/EDIT]

now, python --version
does what I desired:

Python 3.5.5

but trying to

python -mpip install [something]  

gives me

/usr/bin/python: No module named pip

But trying to install python3-pip say:

python3-pip is already the newest version

And, finally the main question: How to get pip working in current situation?

  • Perhaps you should use the command pip3 rather than pip. – joan Apr 11 '18 at 10:28
  • Why are you trying to update Python on a soon-to-be unsupported distro? Stretch includes 3.5.3 (Debian always lags the "latest" to provide a stable tested base) and installing this would be more productive. – Milliways Apr 11 '18 at 11:03
  • 1
    I need to use matplotlib. When try to install it is not happy with anything lower than Python 3.5 – smajli Apr 11 '18 at 11:13
  • I disagree downloading pip with older python versions. With python 2.7 and alternative installs I found the best solution is... activate the builtin pip : python -m ensurepip Sorry I don't use python3, try and give us a feedback. – Massimo Oct 4 '18 at 19:59
1

This kind of scenario is what the get-pip.py script was created for (see pip.pypa). Do:

wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py --user

(assuming that the python is the new symlinked Python 3.5)

What I will say though is that having Python in your home directory like that is probably going to cause some headaches. Did you compile from source? It's much more ideal to use sudo to install Python3.5, then use something like virtualenv if you're going to require local environments.

EDIT: If you're using make altinstall, then forget symlinking using update-alternatives and just use python3.5 at the command-line, because other scripts which call /usr/bin/python expect Python 2, not Python 3.

  • First, I wget python3.5.5 from python.org, and compiled (with sudo). – smajli Apr 11 '18 at 11:11
  • But you didn't sudo make install, otherwise it wouldn't be installed where it is. – Benjamin Crawford Apr 11 '18 at 11:23
  • Where is should be installed? Does it matter where I am at the moment of doing 'sudo make install'? (I was in /home/pi/Python-3.5.5) – smajli Apr 11 '18 at 11:40
  • It will install under /usr/local/. Have you tried the suggestion in the answer? Does python -m pip work now? And well, you have to call it from the Makefile directory otherwise make won't work :) – Benjamin Crawford Apr 11 '18 at 11:48
  • Trying the proposed action from the answer throws an error: "pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available" Anyway: I do have a folder python3.5 in /usr/local/lib. There is a missing folder which I can observe in other python folders, which is dist-packages where pip lives... – smajli Apr 11 '18 at 12:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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