A-A+

centos 7.8 7.9安装python3.9并解决pip install时报错SSL问题

2021年06月27日 Linux 暂无评论 阅读 24 次围观 次

按网上流程安装使用pip时会报错如下内容
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
正确安装方式如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
yum install wget screen -y && screen -S lnmp
sudo yum check-update || sudo yum update -y
yum groupinstall -y 'Development Tools'
yum install -y epel-release
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 bzip2-devel libffi-devel perl perl-devel perl-ExtUtils-Embed libxslt libxslt-devel libxml2 libxml2-devel gd gd-devel GeoIP GeoIP-devel

wget https://www.python.org/ftp/python/3.9.0/Python-3.9.0.tar.xz

tar -xvJf Python-3.9.0.tar.xz

mkdir /usr/local/python3
cd Python-3.9.0

./configure --prefix=/usr/local/python3 --with-ssl-default-suites=openssl

make && make install

ln -s /usr/local/python3/bin/python3 /usr/local/bin/python3
ln -s /usr/local/python3/bin/pip3 /usr/local/bin/pip3

验证:

1
2
python3 -V
pip3 -V

给我留言

Copyright © 老牛博客 保留所有权利.   Theme  Ality

用户登录