In this tutorial, I will show you how to install Python 3.7 on Raspberry Pi running raspbian on it.
Update the Raspbian
Update the Raspbian before installing python.
sudo apt-get update
Before installing python 3.7 there are some dependencies that we need to install. Use the following command to install the required dependencies.
sudo apt-get install -y build-essential tk-dev libncurses5-dev libncursesw5-dev libreadline6-dev libdb5.3-dev libgdbm-dev libsqlite3-dev libssl-dev libbz2-dev libexpat1-dev liblzma-dev zlib1g-dev libffi-dev
1. Download Python
You can download Python from the official website or use the following command.
Read Also: How to install postgresql 11 on Debian 8 / 9
2. Install Python 3.7 On Raspberry Pi
Now we will extract and install Python from the source.
sudo tar zxf Python-3.7.0.tgz
sudo make -j 4
sudo make altinstall
4. Make Python 3.7 as the default version
If you want to use python 3.7 as a default version you can create an alias.
Let’s check the path of Python.
Then source the .bashrc file.
If the path of Python is not /usr/local/bin/python3.7 the use which to get the path of python.
which python3.7and then follow the Step 4 again.
5. Check Python Version
After creating an alias check the python version again.
Now you have successfully installed Python 3.7 on Raspberry Pi.