工作用到,筆記一下
1.下載python 3.6
2.編譯安裝python3.6
3.修改預設python3.6
4.透過yum安裝python & pip3
1.下載python 3.6
#mkdir /usr/local/python3
#cd /usr/local/python3
#curl -O https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz
2.編譯安裝python3.6
#yum -y install gcc*
#yum -y install zlib-devel
#yum -y install epel-release
#tar -xzf Python-3.6.0.tgz
#cd Python-3.6.0
如果要把SSL模組帶入需要調整
#vi Modules/Setup
_ssl _ssl.c \ -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \ -L$(SSL)/lib -lssl -lcrypto
#./configure --prefix=/usr/local/python3
#make;make install
3.修改預設python3.6
#mv /usr/bin/python /usr/bin/python.bak
#ln -s /usr/local/python3/bin/python3 /usr/bin/python
確認版本
#python -V
預設使用了python 3.6 則yum會無法正常運作,因為目前yum相依仍為python2.7,把yum設定改為python2.7 既可
#vi /usr/bin/yum
#vi /usr/libexec/urlgrabber-ext-down
測試安裝lrzsz
#yum -y install lrzsz
4.透過yum安裝python36 & pip3
透過epel-release 也能直接安裝到 python3
#yum -y install epel-release
#yum -y install python36
安裝pip3
#python3 -m ensurepip
更新pip3版本
#pip3 install --upgrade pip
Facebook Comments