CentOS 6.9 compile and install python

Python official website: https://www.python.org/

1. Check the CentOS version and the system default Python version:

cat /etc/redhat-release

python -V

**2. Compile and install Python-3.6.1: **

1、 Install dependent packages:

yum -y groupinstall "Development tools"

yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-develreadline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel man

2、 Set the current system time of CentOS6:

date 040413022017.30

date

3、 Configure host name resolution: # vim /etc/hosts --> 127.0.0.1 localhost

4、 Compile and install Python-3.6.1:

tar xf Python-3.6.1.tar.xz -C /usr/src

cd /usr/src/Python-3.6.1

. /configure --prefix=/usr/local/python3.6.1 --enable-shared --enable-profiling--enable-optimizations --disable-ipv6 --with-threads --with-pymalloc --with-fpectl--enable-loadable-sqlite-extensions

make && make install //This step needs to be tested, which takes a long time

4、 Change the default Python version of CentOS 6.9 to 3.6.1:

mv /usr/bin/python /usr/bin/python2.6.6-old

ln -s /usr/local/python3.6.1/bin/python3 /usr/bin/python

ln -s /usr/local/python3.6.1/bin/pip3 /usr/bin/pip

5、 Add to the PATH environment variable:

vim /etc/profile.d/python3.6.1.sh

exportPATH=/usr/local/python3.6.1/bin:$PATH

. /etc/profile.d/python3.6.1.sh

echo $PATH

6、 Configuration header file:

ln -sv /usr/local/python3.6.1/include /usr/include/python3.6.1

7、 Configuration library file:

echo "/usr/local/python3.6.1/lib" >/etc/ld.so.conf.d/python3.6.1.conf

cat /etc/ld.so.conf.d/python3.6.1.conf

ldconfig

8、 Configure man help files:

vim /etc/man.config, add the following code:

MANPATH /usr/local/python3.6.1/share/man

9、 View the configured Python version:

python -V

python3 -V

3. Modify the Python version in yum to the original 2.6.6 version of the system:

After upgrading Python, yum cannot be used:

vim /usr/bin/yum, modify the "#!/usr/bin/python" in the first line to "#!/usr/bin/python2.6.6-old"

Recommended Posts

CentOS 6.9 compile and install python
CentOS 6 compile and install python 3
CentOs7.3 compile and install Nginx 1.9.9
ubuntu18.04 compile and install python3.8
Centos compile and install Git
CentOS7 install python3 and pip3
Centos7 install Python2.7
Centos install Python3
CentOS6.8 install python2.7
CentOS Yum compile and install MySQL 5.6
CentOS 6.x compile and install Nginx
CentOS7 compile and install L(A|N)MP environment
CentOS quickly install Python3 and pip3
Install Python3 and Py under CentOS7
Linux CentOS6 compile and install Pyt
Install centos7 and connect
Compile and install libmodbus library under CentOS7
CentOS7.5 source code compile and install mysql5.7.29
Centos7 compile and install MySQL8 problem record
Centos python3 compile installation and compile gcc upgrade
Compile and install nodejs and yum in Centos8
CentOS7.4 source code compile and install MySQL8.0
Centos6.5 compile and install LNMP architecture web environment
Centos7.2 compile and install way to build phpMyAdmin
CentOS 7 install Mono and MonoDevelop
Ubuntu 16.04 compile and install PHP 7.2
Centos 6.10 reinstall python and yum
Centos6.5 install and configure mongodb
CentOS7 install OracleJDK and JRE
CentOS6.5 install Java 8 and Tomcat8
CentOS6 install and crack Jira 7
CentOS6.5 install Java 8 and Tomcat8
Centos6 install python3 pip3 ipython3
CentOS6 install and crack confluence
CentOS6 install and crack Jira 7
CentOS + Python3.6+
Centos compile and install LAMP (apache-2.4.7 + mysql-5.5.35 + php 5.5.8) + Redis
1.5 Install Centos7
Compile and install Lnmp shell script under Linux centos
Centos 7.5 python3.6
Centos 7 install jdk and package service service
Install and configure keepalived under CentOS 5.9
CentOS7.3 install iptables and detailed use
How to install Python 3.8 on CentOS 8
CentOS7 yum install and start mysql
CentOS 8 - install and configure NFS service
Centos7 and centos8 install mysql5.6 5.7 8.0 so simple
Centos7 uninstall openJdk, and install JDK1.8
How to install Python on CentOS 8
Install and use docker under CentOS 6.8
CentOS7 install and use SQL Server
Configure python3 environment on centos7 and
CentOS Minimal install and configure TIPS
Install and configure FreeIPA in Centos7
Compile and install QEMU under Ubuntu
virtualBox install centos, and build tomcat
Install Mono 3.2 and Jexus 5.4 under CentOS 6.3
Compile and install the open source EDA tool-Surelog on CentOS8
CentOS8 deploys LNMP environment to compile and install mysql8.0.29 tutorial details
Centos7.3 install nginx
CentOS7.2 install Mysql5.7.13