This article explains how to install python3.6 on Linux system (Ubuntu).
If python2 is installed on this machine, try to leave it alone, just use python3 to run python scripts, because there may be programs that rely on the current python2 environment, such as yum! ! ! ! !
Don't touch the existing python2 environment!
URL: https://www.python.org/downloads/
After downloading from the website, upload it to the Ubuntu environment, or order the download directly.
Assuming the working directory is cd /usr/local, execute the download version command
wget https://www.python.org/ftp/python/3.6.3/Python-3.6.3.tgz
Unzip the downloaded compressed file
tar -xf Python-3.6.3.tgz
cd Python-3.6.3./configure --prefix=/usr/local/python3
make
make install
ln -s /usr/local/python3/bin/python3 /usr/bin/python3
vim ~/.bash_profile
Edit the content and add python3 executable files.
# Get the aliases and functions
if[-f ~/.bashrc ]; then
.~ /.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin:/usr/local/python3/bin
export PATH
Press ESC, type: wq and press Enter to exit.
After the modification, remember to execute the following command to make the modification in the previous step take effect:
source ~/.bash_profile
python3 -V
pip3 -V
# python3 -V
Python 3.6.1
# pip3 -V
pip 9.0.1from/usr/local/python3/lib/python3.6/site-packages(python 3.6)
If it doesn't work, create a pip3 soft link:
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
Recommended Posts