python3.7.2安装包_尝试使用Python 3.7.2pip安装包会导致TSL/SSL错误

我在跑:Amazon Linux AMI 2018.03.0

Linux ip-xxx-yy-z-ww 4.14.77-70.59.amzn1.x86_64 #1 SMP Mon Nov 12 22:02:45 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

多python环境。它同时安装了Python2.7.15和3.7.2。

常规(Python2)pip工作顺利。

当我试图运行pip3 install flask时,会出现以下错误:pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.

Collecting flask

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/flask/

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/flask/

Retrying (Retry(total=2, 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/flask/

Retrying (Retry(total=1, 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/flask/

Retrying (Retry(total=0, 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/flask/

Could not fetch URL https://pypi.org/simple/flask/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/flask/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping

Could not find a version that satisfies the requirement flask (from versions: )

No matching distribution found for flask

pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.

Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping

如果我尝试安装任何其他软件包,也会出现同样的错误。

pip3版本是18.1

添加--trusted-host pypi.org没有帮助。

安装ca证书没有帮助

编辑:

我现在注意到,当在Python 3上运行make时,它成功地完成了,但是有以下消息:Python build finished successfully!

The necessary bits to build these optional modules were not found:

_hashlib _ssl _tkinter

_uuid

To find the necessary bits, look in setup.py in detect_modules() for the module's name.

The following modules found by detect_modules() in setup.py, have been

built by the Makefile instead, as configured by the Setup files:

_abc atexit pwd

time

Could not build the ssl module!

Python requires an OpenSSL 1.0.2 or 1.1 compatible libssl with X509_VERIFY_PARAM_set1_host().

LibreSSL 2.6.4 and earlier do not provide the necessary APIs, https://github.com/libressl-portable/portable/issues/381

编辑2:

我的问题似乎与this相同。但是,除了描述问题之外,线程没有提供任何解决方案。

我试图使用this指南编译一个新版本的openssl。但是新的openssl版本没有解决我的问题。

编辑3:

我找不到解决这个问题的办法。

亚马逊的Linux版本似乎无法与Python3很好地配合。

他们有一个不同的操作系统,叫做Amazon Linux 2,在这里安装Python 3和运行yum install python3一样简单

然而,Amazon Linux 2也有自己的问题。Python 2安装缺少pip。您可以通过运行以下命令手动安装:curl -O https://bootstrap.pypa.io/get-pip.py

python get-pip.py --user

但这实际上覆盖了pip3,所以Python 3仍然没有pip。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值