Python3 --- CentOS7 installation Python3

  • And download the package dependencies

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

yum install -y gcc gcc-c++ zlib* make -y

  • Extracting installer

mkdir -p /usr/local/python3
tar -xzvf Python-3.6.1.tgz -C /opt

  • Edit compile and install

cd /opt/Python-3.6.1

./configure --prefix=/usr/local/python3

make && make install

  • Softlinks, easy to use

ln -s /usr/local/python3/bin/python3 /usr/bin/python3

  • Set the environment variable python

echo "export PATH=$PATH:$HOME/bin:/usr/local/python3/bin" >> ~/.bash_profile

  • test

[root @ cloud Python-3.6.1] # python3 -V
Python 3.6.1

Published 139 original articles · won praise 168 · views 40000 +

Guess you like

Origin blog.csdn.net/qq_42761527/article/details/104881871