解决ubuntu环境下pip is configured with locations that require TLS/SSL, however the ssl module...

在Ubuntu环境下,由于缺少openssl库导致pip安装时SSL模块不可用。为了解决这个问题,需要通过sudo apt-get install openssl和sudo apt-get install libssl-dev安装openssl相关组件。之后,重新编译Python,指定配置选项--with-ssl-default-suites=openssl,并完成make和make install步骤,成功修复Python的SSL模块缺失问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

问题:

root@d66efd26efba:~# pip install termcolor                                                       
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/termcolor/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/termcolor/
...
root@d66efd26efba:~# 

解决:

# ubuntu下安装openssl-devel 
$ sudo apt-get install openssl
$ sudo apt-get install libssl-dev

#重新编译python3.7.10
$ cd Python-3.7.10
$ ./configure --with-ssl-default-suites=openssl
$ make
$ sudo make install
#
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值