安裝環(huán)境
yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
下載后進(jìn)入下載的目錄進(jìn)行解壓
tar -zxvf Python-3.9.4.tar
解壓后執(zhí)行:
--prefix 后面的是解壓的項(xiàng)目路徑
./configura --prefix=/soft/python/Python-3.9.4
若執(zhí)行時(shí)提示:
configure: error: no acceptable C compiler found in $PATH
是因?yàn)槿鄙倭?gcc模塊
執(zhí)行yum安裝
yum -y install gcc
安裝后重新執(zhí)行
./configura --prefix=/soft/python/Python-3.9.4
執(zhí)行編譯:
make && make install
創(chuàng)建軟連接
ln -s /自己的安裝地址 /usr/bin/python3
設(shè)置環(huán)境變量
export PATH=$PATH:$HOME/bin:/soft/python/Python-3.9.4/bin
# 不確定這布是否有用
source ~/.bash_profile
驗(yàn)證結(jié)果
python3 -V
pip3 -V