CentOS install Python 3.6
surroundings###
- CentOS7.5
Start###
- Prepare a CentOS
- Download the Python source code package from the official website and drag it to the server using the tool Xftp
- Install Python dependency packages in centos
yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make
- Unzip Python (/opt/Python-3.6.4.tgz is the storage path of the Python source code package)
tar -xzvf /opt/Python-3.6.4.tgz -C /usr/local/src/
- Enter the unzipped directory
cd /usr/local/src/Python-3.6.4./configure --prefix=/usr/local/python3
- Install Python
make && make install
- Permanently add environment variables
Enter /etc/profile.d/ to create a new python3.sh file, and add export PATH="$PATH:/usr/local/python3/bin" to the python3.sh file
cd /etc/profile.d/
vi python3.sh
export PATH="$PATH:/usr/local/python3/bin"
- Overload environment variables
source ../profile
- test
pytohn3