银河麒麟安装Python3.7.4以及升级自带OpenSSL

qilin、.png

升级OpenSSL

1.下载openssl

wget https://www.openssl.org/source/openssl-1.1.1a.tar.gz
tar -zxvf openssl-1.1.1a.tar.gz
cd openssl-1.1.1a

2.编译安装

./config --prefix=/usr/local/openssl no-zlib  #不需要zlib
make
make install

3.备份原配置

mv /usr/bin/openssl /usr/bin/openssl.bak
mv /usr/include/openssl/ /usr/include/openssl.bak

4.新版配置

ln -s /usr/local/openssl/include/openssl /usr/include/openssl
ln -s /usr/local/openssl/lib/libssl.so.1.1 /usr/local/lib64/libssl.so 
# 这里可能会提示路径不存在,可以直接创建
ln -s /usr/local/openssl/bin/openssl /usr/bin/openssl

5.写入openssl库文件的搜索路径

echo "/usr/local/openssl/lib" >> /etc/ld.so.conf

6.使修改后的/etc/ld.so.conf生效

ldconfig -v

7.查看openssl版本

openssl version

安装python3.7.4

# 下载源码包并解压
cd ~
wget https://www.python.org/ftp/python/3.7.4/Python-3.7.4.tar.xz
sudo apt-get install  gcc libffi-devel zlib* openssl-devel
xz -d Python-3.7.4.tar.xz
tar xvf Python-3.7.4.tar

# 设置路径和安装
cd Python-3.7.4
./configure --prefix=/usr/local/python3 --with-openssl=/usr/local/openssl
make
make install

软连接

sudo ln -s /usr/local/python3.7/bin/python3 /usr/bin/python3.7

查看结果

python3.7 -V
# 显示结果为: Python 3.7.4

安装python3.7.4成功,同时。系统中的python2和python3.5.2也存在

安装pip3.7

sudo ln -s /usr/local/python3.7/bin/pip3.7 /usr/bin/pip3.7

测试:

pip3.7 install dicttoxml

更新pip至最新版本:

sudo python3.7 -m pip3.7 install --upgrade pip
pip3.7 -V  # 查看pip版本
Last modification:January 19th, 2020 at 08:56 pm
If you think my article is useful to you, please feel free to appreciate