How to download and install Python 3.5 in Raspbian - Raspberry Pi Stack Exchange
How to install python 3 and setuptools on raspberry pi? - Stack Overflow
repository - Raspberry pi - can't install Python 3.11 - Stack Overflow
GUIDE: How to establish Bluetooth serial communication between two Pi 3's
Videos
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.
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!
If you want to install the Python 3.X version of pip you need to target aptitude to the good package:
sudo apt-get install python3-pip
For more info http://packages.debian.org/wheezy/python3-pip
sudo apt-get install python3-pip
or for python 2:
sudo apt-get install python-pip