The specific steps to upgrade python on Raspberry Pi

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

  1. Update Raspberry Pi system
$ sudo apt-get update
$ sudo apt-get upgrade -y
  1. Install python dependency environment
$ sudo apt-get install build-essential libsqlite3-dev sqlite3 bzip2 libbz2-dev
  1. Download the python3.6 version source code and unzip it
$ 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
  1. Compile and install. Since the compilation process is relatively long, we can combine several commands for compiling and installing, so that you can go for a cup of coffee and wait for a while and you will be prompted that the installation is successful.
sudo ./configure && sudo make && sudo make install
  1. Establish soft connection

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
  1. Next, you need to soft link Python 3.6.1 to python, which is convenient to use.

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
  1. Then establish a soft connection
pi@raspberrypi:~ $ sudo mv /usr/bin/python /usr/bin/python3.4.2 
pi@raspberrypi:~ $ sudo ln -s /usr/local/bin/python3 /usr/bin/python
  1. Ok, so the soft connection is successfully established.

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

The specific steps to upgrade python on Raspberry Pi
ubuntu16.04 method steps to upgrade the kernel
How to install Ubuntu on Raspberry Pi
How to install Ubuntu 19.10 on Raspberry Pi 4
How to upgrade all Python libraries on Ubuntu 18.04
Centos 6.4 python 2.6 upgrade to 2.7
Centos default python2.6 upgrade to
Upgrade Ubuntu 18.04 on Azure to 18.10
Method steps to increase python font
How to save the python program
How to upgrade to PHP 7 on Ubuntu 14.04
How to install Python 3.8 on CentOS 8
How to install Python 3.8 on Ubuntu 18.04
Centos6.7 comes with python upgrade to
How to install Python on CentOS 8
Steps to enter python through cmd
How to view the python module
Steps to upgrade Laravel 5.4 to 5.6 in Ubuntu 16.04
Install the latest Python 3.6 version on Ubuntu
Python string to judge the password strength
Steps to build LNMP environment on ubuntu 20.04
R&D: How To Install Python 3 on CentOS 7
The specific method of python instantiation object
How to install Python2 on Ubuntu20.04 ubuntu/focal64
How to learn the Python time module
Use python3 to install third on ubuntu
How to modify the hostname on CentOS 8
The specific method of python import library
How to modify the hostname on Ubuntu 20.04
How to use the round function in python
Detailed steps to install Anaconda on Linux (Ubuntu 18.04)
How to use the zip function in Python
How to program based on interfaces in Python
An article to understand the yield in Python
Detailed steps to install Anaconda on Linux (Ubuntu 18.04)
The easiest way to install Chrome on CentOS 6
How to use the format function in python
How to play happily with Python3 on Ubuntu
How to enter python through the command line
[Practice] How to install python3.6 on Ubuntu system
How to switch the hosts file using python
How to install the downloaded module in python
The ultimate guide to install gooderp on ubuntu
Python how to move the code collectively right
How to run the parsing server on Ubuntu 14.04
The best way to judge the type in Python
How to check the installed JDK on Ubuntu
Use python to realize the aircraft war game
How to install the latest MySQL on Ubuntu 18.04