Before deploying Python on CentOS, we need to configure the development environment first.
1. Install Python-dependent development kit
GCC is natural and can be used directly with "Development Tools":
Yum grouplist #查看可安装的包yum groupinstall "Development tools" #含有空格用引号括起来thereis gcc #查看gcc安装位置gcc-- Version #查看gcc安装版本
There are a few other dependent packages
Install Zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel#zlib-devel # Bzip2-devel #openssl-devel #ncurses-devel #sqlite-devel #readline-devel #tk-devel
2. Install the latest Python3.6
To view the installed Python information:
Python-v
Then take a look at the location of the Python executable file:
which Python
#输出:/usr/bin/python
Go to the Bin directory and view the Python file:
Cd/usr/binls-al python* output: lrwxrwxrwx. 1 root root 7 Dec python-python2lrwxrwxrwx. 1 root root 9 Dec python2-Python2. 7-rwxr-xr-x. 1 root root 7136 Nov 6 python2.7
#可以看到可执行文件python指向python2, Python2 also points to python2.7, which means that the Python command executes the preinstalled Python2.7 of the system.
CentOS Deployment Python Environment