1、 Install python3
sudo apt install python3
2、 Uninstall python2.7 (optional)
sudo apt remove python
3、 Then execute the following command to automatically clean up python2.7 dependencies
sudo apt autoremove
4、 Delete the original python link
sudo rm /usr/bin/python
5、 Create a new link to the python3.5 just installed
sudo ln -s /usr/bin/python3.5 /usr/bin/python
Content expansion:
Raspberry Pi upgrade Python to 3.6
$ sudo apt-get update
$ sudo apt-get upgrade -y
$ sudo apt-get install build-essential libsqlite3-dev sqlite3 bzip2 libbz2-dev
$ wget https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tgz
$ tar zxvf Python-3.6.1.tgz
$ cd Python-3.6.1
sudo ./configure && sudo make && sudo make install
After installing python3.6, we can look at the version of python
pi@raspberrypi:~ $ python --version
Output: Python 3.4.2
pi@raspberrypi:~ $ python3 --version
Output: Python 3.6.1
Let's take a look at where python3 and python commands are respectively
pi@raspberrypi:~ $ which python
Output:/usr/bin/python
pi@raspberrypi:~ $ which python3
Output:/usr/local/bin/python3
pi@raspberrypi:~ $ sudo mv /usr/bin/python /usr/bin/python3.4.2
pi@raspberrypi:~ $ sudo ln -s /usr/local/bin/python3 /usr/bin/python
Whether the test was successful
pi@raspberrypi:~ $ python --version
Output: Python 3.6.1
OK, you can see that the python on the Raspberry Pi has been successfully upgraded to Python 3.6.1
So far, this article on the specific steps of upgrading python on Raspberry Pi is introduced. For more information on how to upgrade python on Raspberry Pi, please search the previous articles of ZaLou.Cn or continue to browse related articles below. Hope you will get more Support ZaLou.Cn!
Recommended Posts