你要安裝python的目錄python
cd /opt
工做中大部分安裝在/optsql
在安裝目錄下下載python3.7.2vim
sudo wget https://www.python.org/ftp/python/3.7.2/Python-3.7.2rc1.tgz
spa
安裝依賴code
yum install gcc patch libffi-devel python-devel zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel -y
解壓源碼包sqlite
tar -zxvf Python-3.7.2rc1/
ip
進入解壓後的文件夾ssl
cd Python-3.7.2rc1/
get
調用 Python-3.7.2rc1路徑底下的configure腳本文件源碼
make
make install //此時會生成python37文件夾,python3.7.2就是安裝在這了
修改全局變量
vim /etc/profile
PATH=/opt/python37/bin:/opt/python36/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin