简体   繁体   English

使用pip安装python软件包时出错(TLSV1_ALERT_PROTOCOL_VERSION)

[英]Error installing python package with pip (TLSV1_ALERT_PROTOCOL_VERSION)

I'm on Suse Linux Enterprise 11 SP4 and I'm trying to install a python package using pip but it's failing with the following error: 我在Suse Linux Enterprise 11 SP4上,并尝试使用pip安装python软件包,但失败并出现以下错误:

Env: 信封:

$ python --version
Python 3.6.6

$ pip --version
pip 10.0.1 from /home/<<user>>/.pyenv/versions/3.6.6/lib/python3.6/site-packages/pip (python 3.6)

Command: 命令:

$ pip install sendgrid

Error: 错误:

Collecting sendgrid
  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:841)'),)': /simple/sendgrid/
...
...
  Could not fetch URL https://pypi.org/simple/sendgrid/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/sendgrid/ (Caused by SSLError(SSLError(1, '[SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:841)'),)) - skipping
  Could not find a version that satisfies the requirement sendgrid (from versions: )
No matching distribution found for sendgrid
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(SSLError(1, '[SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:841)'),)) - skipping

I have tried all this solutions but none of them had work on SLES. 我已经尝试了所有这些解决方案,但是没有一个在SLES上起作用。

Any ideas? 有任何想法吗?

Thanks in advance 提前致谢

You can ignore SSL errors by setting pypi.org and files.pythonhosted.org as trusted hosts. 您可以通过将pypi.org和files.pythonhosted.org设置为可信主机来忽略SSL错误。

pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org <package_name>

Or: 要么:

Try installing using the wheel of the package 尝试使用包装箱的轮子进行安装

Finally I get it to work! 终于,我开始工作了!

Seems that the openssl library that came installed by default on SLES 11 SP4 ( libopenssl-devel ) is really outdated ( OpenSSL 0.9.8 ) 似乎默认在SLES 11 SP4上安装的openssl库( libopenssl-devel )确实过时了( OpenSSL 0.9.8

To verify this you can run: 要验证这一点,您可以运行:

$ python -c "import ssl; print(ssl.OPENSSL_VERSION)"
OpenSSL 0.9.8j-fips 07 Jan 2009

The trick is to uninstall libopenssl-devel and install libopenssl1-devel like this: 诀窍是卸载 libopenssl-devel安装 libopenssl1-devel如下所示:

IMPORTANT: Note that you will be asked to take an option, please select deinstallation of libopenssl-devel-0.9.xx.xxx.xxx 重要提示:请注意,系统会要求您选择一个选项,请选择卸载libopenssl-devel-0.9.xx.xxx.xxx

$ sudo zypper install libopenssl1-devel

Loading repository data...
Reading installed packages...
Resolving package dependencies...

Problem: libopenssl1-devel-1.0.1g-0.58.9.1.x86_64 conflicts with libopenssl-devel < 1.0.1 provided by libopenssl-devel-0.9.8j-0.106.9.1.x86_64
 Solution 1: deinstallation of libopenssl-devel-0.9.8j-0.106.9.1.x86_64
 Solution 2: do not install libopenssl1-devel-1.0.1g-0.58.9.1.x86_64

Choose from above solutions by number or cancel [1/2/c] (c): 1
Resolving dependencies...
Resolving package dependencies...

The following NEW package is going to be installed:
  libopenssl1-devel 

The following package is going to be REMOVED:
  libopenssl-devel 

1 new package to install, 1 to remove.
Overall download size: 3.3 MiB. After the operation, 698.0 KiB will be freed.
Continue? [y/n/? shows all options] (y): 
Retrieving package libopenssl1-devel-1.0.1g-0.58.9.1.x86_64 (1/1), 3.3 MiB (19.6 MiB unpacked)
Retrieving: libopenssl1-devel-1.0.1g-0.58.9.1.x86_64.rpm [done]
Removing libopenssl-devel-0.9.8j-0.106.9.1 [done]
Installing: libopenssl1-devel-1.0.1g-0.58.9.1 [done]

Now procede to recompile/reinstall your python env with: 现在继续使用以下命令重新编译/重新安装您的python env:

$ CFLAGS=-I/usr/include/openssl1 LDFLAGS=-L/usr/lib64 pyenv install 3.6.6

Finally verify that your OpenSSL version is the new one and proceed to install your package with pip : 最后,确认您的OpenSSL版本是新版本,然后继续使用pip安装软件包:

$ python -c "import ssl; print(ssl.OPENSSL_VERSION)"
OpenSSL 1.0.1g 7 Apr 2014

$ pip install sendgrid

Hope it helps you! 希望对您有帮助!

Please see 'Security Module in SUSE Linux Enterprise 11' for more info 有关更多信息,请参见“ SUSE Linux Enterprise 11中的安全模块”

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 升级pip /安装Django-[SSL:TLSV1_ALERT_PROTOCOL_VERSION] - Upgrading pip/installing django - [SSL: TLSV1_ALERT_PROTOCOL_VERSION] TLSV1_ALERT_PROTOCOL_VERSION 与 python 请求包 - TLSV1_ALERT_PROTOCOL_VERSION with python requests package 无法安装 Python 包 [SSL: TLSV1_ALERT_PROTOCOL_VERSION] - Not able to install Python packages [SSL: TLSV1_ALERT_PROTOCOL_VERSION] 无法安装任何库[SSL:TLSV1_ALERT_PROTOCOL_VERSION] - Not able to install any library [SSL: TLSV1_ALERT_PROTOCOL_VERSION] 仍然无法安装自动登录-TLSV1_ALERT_PROTOCOL_VERSION - still cannot install autologin - TLSV1_ALERT_PROTOCOL_VERSION requests.exceptions.SSLError:[SSL:TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version(_ssl.c:590) - requests.exceptions.SSLError: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:590) Python - Docker 客户端连接中的 tlsv1 警报协议版本错误 - Python - tlsv1 alert protocol version error in Docker client connection 无法在 Ubuntu Linux 中使用 pip 安装 Python 包:InsecurePlatformWarning、SSLError、tlsv1 警报协议版本 - Unable to install Python packages using pip in Ubuntu Linux: InsecurePlatformWarning, SSLError, tlsv1 alert protocol version 在python中使用请求时,出现以下错误“ TLSV1_ALERT_PROTOCOL_VERSION”。为什么会发生这种情况? - When using requests in python I'm given the following error “TLSV1_ALERT_PROTOCOL_VERSION.” Why might this be happening? Python HTTPS/SSL 错误:1407742E:SSL 例程:SSL23_GET_SERVER_HELLO:tlsv1 警报协议版本 - Python HTTPS/SSL error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM