How to install python in ubuntu server environment

This article describes the method of installing python in the ubuntu server environment. Share with you for your reference, as follows:

The ubuntu 14.04-16.04 version installs python 2.7 by default

1、 View current python version

$python --version

2、 Upgrade to python3.X version

$sudo add-apt-repository ppa:fkrull/deadsnakes#Add a source
$sudo apt-get update#Update the source list to get the latest version
$sudo apt-get install python3#Use apt-get to install

3、 After the installation is complete, there are two options for changing the system environment.

① Situation 1:

Use alias alias, add the following statement to ~/.bashrc or ~/.bash_aliases

alias python=python3

Note: switch back to python2 environment

alias python=python2

② Case two, directly change the direction of the version:

(1) Check the current default execution environment version, if this item does not include python, you can skip it.

android@local:/usr/local/bin$ls
apktoolpython

(2) Delete the current default python environment script

android@local:/usr/local/bin$ sudo rm /usr/local/bin/python
android@local:/usr/local/bin$ ls
apktool apktool.jar

(3) View the installed python version contained in the /usr/bin/ path.

ls /usr/bin/

(4) Switch to the version below /usr/bin/

android@local:/usr/local/bin$sudo ln -s /usr/bin/python3 /usr/local/bin/python

Note: switch back to python2 environment

android@local:/usr/local/bin$sudo
ln -s /usr/bin/python2 /usr/local/bin/python

**Other situations: **

If you encounter other problems and need to be fixed, just download it again:

sudo apt-get
install --reinstall python-minimal
sudo apt-get
install --reinstall python2.7

I hope this article will help you configure your Ubuntu server.

Recommended Posts

How to install python in ubuntu server environment
How to install Helm in Ubuntu
How to install mysql in Ubuntu 14.04
How to install Python 3.8 on Ubuntu 18.04
How to install mysql in Ubuntu 14.04
How to create a Python virtual environment in Ubuntu 14.04
How to install Bacula Server on Ubuntu 14.04
How to install third-party modules in Python
How to install cuda10.1 driver in Ubuntu
How to install ROS Noetic in Ubuntu20.04
How to install memcache and start it in ubuntu environment
Install python in Ubuntu
How to install Python2 on Ubuntu20.04 ubuntu/focal64
How to compile and install PHP and Nginx in Ubuntu environment
How to install Zabbix on Ubuntu 16.04 Server
How to install Squid proxy server on Ubuntu 18.04
How to configure TensorFlow use environment in Ubuntu
Install Python3 environment in a brand new Ubuntu
[Practice] How to install python3.6 on Ubuntu system
How to install the downloaded module in python
How to compile and install xdebug from source code in Ubuntu environment
How to install Hadoop in standalone mode on Ubuntu 18.04
How to install Ruby on Ubuntu 20.04
How to install Memcached on Ubuntu 20.04
How to install Java on Ubuntu 20.04
How to install MySQL on Ubuntu 20.04
How to use hanlp in ubuntu
How to install Elasticsearch on Ubuntu 20.04
How to install Protobuf 3 on Ubuntu
How to install Nginx on Ubuntu 20.04
How to install Node.js on Ubuntu 16.04
How to install MySQL on Ubuntu 20.04
How to wrap in python code
How to install PHP7.4 in CentOS
How to install Bacula-Web on Ubuntu 14.04
How to install PostgreSQL on Ubuntu 16.04
How to install Git on Ubuntu 20.04
How to install Anaconda3 on Ubuntu 18.04
How to install Memcached on Ubuntu 18.04
How to install Jenkins on Ubuntu 16.04
How to install MemSQL on Ubuntu 14.04
How to install Go on Ubuntu 20.04
How to install MongoDB on Ubuntu 16.04
How to install Mailpile on Ubuntu 14.04
How to install PrestaShop on Ubuntu 16.04
How to install Skype on Ubuntu 20.04
How to install Jenkins on Ubuntu 20.04
How to omit parentheses in Python
How to install Python 3.8 on CentOS 8
How to write classes in python
How to install KVM on Ubuntu 18.04
How to filter numbers in python
How to install KVM on Ubuntu 20.04
How to install opencv3.0.0 on ubuntu14.04
How to install Anaconda on Ubuntu 20.04
How to install Prometheus on Ubuntu 16.04
How to read Excel in Python
How to install Jenkins on Ubuntu 18.04
How to install Apache on Ubuntu 20.04
How to install R on Ubuntu 20.04
How to install Python on CentOS 8