1.查看centos中自带的Python地址:which python(一般在 /usr/bin/python)
2.切换到python安装目录:cd /usr/bin
3.查看对应的Python版本指向:ls -l python*
4.创建一个空目录:mkdir /usr/local/python3
5.升级安装对应的依赖:
#yum -y groupinstall "Development tools" #yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel
#yum -y install db4-devel libpcap-devel xz-devel
#yum install libffi-devel -y
#yum install epel-release -y
#yum install gcc -y
6.下载Python3:
#wget https://www.python.org/ftp/python/3.7.2/Python-3.7.2.tar.xz
7.解压Python-3.7.2.tar.xz
#tar -xvJf Python-3.7.2.tar.xz
8.配置./configure --prefix优化:
切换到Python-3.7.2中
#cd Python-3.7.2
#./configure --prefix=/usr/local/pthon3
8.安装Python:
#make && make install > install.log (安装日志看个人需求)
9.软连接创建:
#cd Python3.7.2中 (在该路径下进行配置)
#ln -s /usr/local/python3/bin/python3 /usr/bin/python3 #ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
10.验证安装成功: