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.驗證安裝成功:
?