ubuntu16.04 upgrade python2

Reference: https://www.cnblogs.com/wmr95/p/7637077.html

Under normal circumstances, ubuntu16.04 will automatically install the python2.7 version, here I try to upgrade it to python3.5 version

One: Open the terminal of ubuntu and enter the command on the command line:

python

The display is as follows, indicating that the python version that comes with the system is python2.7.12

Two: Enter the command on the command line:

sudo apt-get install python3 (install python3.5 here, the command is: sudo apt-get install python3.5)

After entering your password, it will download. The Python program just downloaded is installed in usr/localb/python3.5.

Three: Specify the python3.5 version (your newly installed python version) to be opened by default.

After the installation is complete, you enter python in the terminal, and the output information will prompt that it is version 2.7, which means that the default version is not the 3.5 installed just now, so we need to modify the link again. Methods as below:

Step 1: Back up the original link first (it is a good habit to back up before deleting the system). Enter the command under ternimal:

sudo cp /usr/bin/python /usr/bin/python_bak

Step 2: Delete the link that originally pointed to the python2.7 version by default. Enter the command under ternimal:

sudo rm /usr/bin/python

Step 3: Re-assign the new link to python3.5 version. input the command:

sudo ln -s /usr/bin/python3.5 /usr/bin/python

At this point, the python version update has been completed.

Note: Switch between python2.7 and 3.5 at will (here 3.5 switches back to 2.7):

sudo rm /usr/bin/python

sudo ln -s /usr/bin/python2.7 /usr/bin/python

Recommended Posts

ubuntu16.04 upgrade python2
ubuntu18.04 install python2
Relearn ubuntu --python3
CentOS7 upgrade python3
ubuntu12.04 install python3
Ubuntu14 upgrade MySQL
ubuntu14.04.1 upgrade openssh
ubuntu18.04 install python
Ubuntu18.04 switch Python version
Install python3.6 under Ubuntu 16.04
ubuntu configuration python, Red
Centos 6.4 python 2.6 upgrade to 2.7
Ubuntu16.04 switch python version
How to upgrade to Ubuntu 20.04
[python] python2 and python3 under ubuntu
Install Python3 on Ubuntu 14.04
Python virtual environment: Ubuntu16.04
Install python in Ubuntu
Install Python3 on Ubuntu 16.04
Install Python3.7 on Ubuntu
How to upgrade all Python libraries on Ubuntu 18.04
Centos default python2.6 upgrade to
Ubuntu install the latest Python 3.
Install Python 3.7 on Ubuntu 18.04 LTS
ubuntu sets python2.5 environment variables
ubuntu18.04 compile and install python3.8
Upgrade Ubuntu 18.04 on Azure to 18.10
ubuntu view python installation path
Server upgrade Ubuntu 20.04 LTS record
Server upgrade Ubuntu 20.04 LTS record
ubuntu build python development environment
ubuntu offline installation python environment
How to upgrade to Ubuntu 16.04 LTS
How to upgrade to PHP 7 on Ubuntu 14.04
How to install Python 3.8 on Ubuntu 18.04
Centos6.7 comes with python upgrade to
Python Chinese encoding setting under ubuntu
Install Python virtual environment on Ubuntu 18.04
Install TensorFlow (python2.7 version) on Ubuntu
Ubuntu upgrade software and ubuntu upgrade system commands
Steps to upgrade Laravel 5.4 to 5.6 in Ubuntu 16.04
Install the latest Python 3.6 version on Ubuntu
Detailed tutorial on installing python3.7 for ubuntu18
Python multithreading
Error when installing Python module on Ubuntu
Python CookBook
Python FAQ
Python3 dictionary
ubuntu16.04 method steps to upgrade the kernel
Python3 module
python (you-get)
Python string
Python basics
Python descriptor
Python exec
Python notes
CentOS + Python3.6+
Python advanced (1)
Python decorator
Python IO
Python multithreading