centos6 安裝python3.8

yum install -y zlib zlib-dev openssl-devel sqlite-devel bzip2-devel libffi libffi-devel gcc gcc-c++
wget http://www.openssl.org/source/openssl-1.0.2j.tar.gz   #直接安装 pip是不能用的,原因是依赖ssl 1.0.2以上版本,要更新OpenSSL 版本。


#更新OpenSSL
tar -zxvf openssl-1.0.2j.tar.gz
cd openssl-1.0.2j
./config --prefix=$HOME/openssl shared zlib
make && make install
echo "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/openssl/lib" >> $HOME/.bash_profile
source $HOME/.bash_profile



#安装Python3.8 ,下载地址官方找。
tar -zxvf Python-3.8.0.tgz
cd Python-3.8.0

./configure --prefix=/usr/local/python3.8 --with-openssl=$HOME/openssl
make && make install
#更新 pip
pip install --upgrade pip
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pyinstaller  #使用清华的pip 源安装pyinstaller(个人需要)



安装后不能直接运行需要创建软连接
ln -s /usr/local/python3.8/bin/python3.8 /usr/bin/python3 
ln -s /usr/local/python3.8/bin/pip3 /usr/bin/pip 
ln -s /usr/local/python3.8/bin/pyinstaller /usr/bin/pyinstaller      #个人需要 

你可能感兴趣的:(centos6 安裝python3.8)