Home  >  Article  >  Backend Development  >  How to install python in Ubuntu

How to install python in Ubuntu

尚
Original
2019-07-02 15:30:148877browse

How to install python in Ubuntu

Ubuntu16.04 has Python2.7 and 3.5 installed by default

Please note that the python that comes with the system must not be uninstalled!

Enter the command python

How to install python in Ubuntu

Press Ctrl D to exit the python command line

How to install python in Ubuntu

Enter the command sudo add -apt-repository ppa:jonathonf/python-3.6

How to install python in Ubuntu

Press Enter to confirm

Enter the command sudo apt-get update

Enter the command sudo apt-get install python3.6

Press Y to confirm

Adjust the priority of Python3 so that 3.6 has a higher priority

sudo update-alternatives --install /usr /bin/python3 python3 /usr/bin/python3.5 1

sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 2

Change The default value, python defaults to Python2, is now modified to Python3

sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 100

sudo update-alternatives - -install /usr/bin/python python /usr/bin/python3 150

At this time, enter the command python

How to install python in Ubuntu

You can see that it is already Python3.6

For more Python-related technical articles, please visit the Python Tutorial column to learn!

The above is the detailed content of How to install python in Ubuntu. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn