8

Tried to use

sudo apt-get install python3.5

and it's telling me that it can't find it. Have tried updating. Not sure what else to do.

not2qubit
  • 1,297
  • 1
  • 11
  • 22
Sig
  • 89
  • 1
  • 1
  • 2
  • 1
    What version of Raspbian are you using? What model Pi? How is the Pi connected to the internet? What is the specific error code? We are going to need more information, currently you question is very, very vague. – Darth Vader Sep 02 '16 at 07:44

3 Answers3

12

I tried installing the python3.5.2 with the below steps and I was successful.

1. wget https://www.python.org/ftp/python/3.5.2/Python-3.5.2.tar.xz
2. tar -xvf Python-3.5.2.tar.xz
3. cd Python-3.5.2
4. ./configure
5. make
6 make altinstall

Once the installation is completed use which python3.5 command to get the binary location

In my case it was installed in the location /usr/local/bin/python3.5.

To get into the REPL of 3.5 type python3.5 on your terminal. The existing python distribution remains intact without issues. Verify that using the python. I have tried installing python 3.4 and 3.5 versions.

pi@raspberrypi:/etc/openhab/configurations $ python -V
Python 2.7.9
pi@raspberrypi:/etc/openhab/configurations $ python3.5 -V
Python 3.5.2
pi@raspberrypi:/etc/openhab/configurations $ python3.4 -V
Python 3.4.2

Also as time permits I suggest you to read the article https://stackoverflow.com/questions/16018463/difference-in-details-between-make-install-and-make-altinstall.

It should work. The only issue while i faced during installation is the time taken for the whole process. It took almost 3 hours because a lot of time is consumed in compiling the binaries and then installing python.

Varad A G
  • 848
  • 6
  • 16
7

First of all you need to get your dependencies right. That mostly depend on what you have already installed previously. So for a vanilla fresh Raspbian (jessie), you will (approximately) need to make sure you have these:

sudo apt-get install build-essential libc6-dev
sudo apt-get install libncurses5-dev libncursesw5-dev libreadline6-dev
sudo apt-get install libdb5.3-dev libgdbm-dev libsqlite3-dev libssl-dev
sudo apt-get install libbz2-dev libexpat1-dev liblzma-dev zlib1g-dev

The rest is simple. First download and extract...

cd $HOME
wget https://www.python.org/ftp/python/3.5.2/Python-3.5.2.tgz
tar -zxvf Python-3.5.2.tgz

...and then compile with:

cd Python-3.5.2
./configure       # 3 min 13 s
# We have 4 processors, so let's use 4 threads
make -j4          # 8 min 29 s
sudo make install # ~ 4 min

Save your SD card space:

cd ..
sudo rm -fr ./Python-3.5.2*

Now test with:

cd
python3 --version
# output: "Python 3.5.2"
pip3 list
# output: 
# pip (8.1.1)
# setuptools (20.10.1)
# You are using pip version 8.1.1, however version 8.1.2 is available.
# You should consider upgrading via the 'pip install --upgrade pip' command.

Update your default pip installation with:

sudo pip3 install -U pip
sudo pip3 install -U setuptools

Done!

not2qubit
  • 1,297
  • 1
  • 11
  • 22
0

Combining several different posts finally worked for me to Install Python 3.6.12 on Jessie Raspian.

Install Dependencies:

sudo apt-get install build-essential libc6-dev
sudo apt-get install libncurses5-dev libncursesw5-dev libreadline6-dev
sudo apt-get install libdb5.3-dev libgdbm-dev libsqlite3-dev libssl-dev
sudo apt-get install libbz2-dev libexpat1-dev liblzma-dev zlib1g-dev

Install Alternative Compiler:

sudo apt install clang

Get Python Source Code, configure, make and install:

cd
wget https://www.python.org/ftp/python/3.6.12/Python-3.6.12.tgz
tar xf Python-3.6.12.tgz
cd Python-3.6.12
./configure CC=clang CXX=clang++
sudo make
sudo make install

I don't recommend trying to make Python 3.7 or greater as it requires a later version of OpenSSL than is installed on Jessie. I tried to get an updated version to install, but gave up after lots of attempts.

Chris H
  • 101