Install Python3 environment under ubuntu 16.04

ubuntu comes with python2.7 and python3.5, but in many cases we need a higher version of python, which requires us to install it manually. Let's take python3.7 as an example to install it on the server.

1. Download the installation package

wget https://www.python.org/ftp/python/3.7.1/Python-3.7.1.tgz

2. Unzip

tar -zxvf Python-3.7.1.tgz

3. Create the installation directory

sudo mkdir -p /usr/local/python3

4. Installation dependencies

sudo apt-get install libffi-dev

5. Switch to the unzipped directory

cd Python-3.7.1

6, compile and install

  • ./configure --prefix=/usr/local/python3 --enable-optimizations
  • make
  • sudo make install

7. Establish a connection point

  • Add python3.7 soft link
    ln -s /usr/local/python3/bin/python3.7 /usr/bin/python3.7
  • Add pip3.7 soft link
    ln -s /usr/local/python3/bin/pip3.7 /usr/bin/pip3.7

8. Test whether the installation is successful

The installation is successful when the icon appears

Guess you like

Origin blog.csdn.net/DearestFriend/article/details/105671189