每当我尝试通过pip install <package>
从Amazon EC2实例安装软件包时,都会遇到以下问题:
pip install opencv-python
Collecting opencv-python
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError("bad handshake: Error([('rsa routines', 'INT_RSA_VERIFY', 'bad signature'), ('asn1 encoding routines', 'ASN1_item_verify', 'EVP lib'), ('SSL routines', 'ssl3_get_server_certificate', 'certificate verify failed')],)",),)': /simple/opencv-python/
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError("bad handshake: Error([('rsa routines', 'INT_RSA_VERIFY', 'bad signature'), ('asn1 encoding routines', 'ASN1_item_verify', 'EVP lib'), ('SSL routines', 'ssl3_get_server_certificate', 'certificate verify failed')],)",),)': /simple/opencv-python/
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError("bad handshake: Error([('rsa routines', 'INT_RSA_VERIFY', 'bad signature'), ('asn1 encoding routines', 'ASN1_item_verify', 'EVP lib'), ('SSL routines', 'ssl3_get_server_certificate', 'certificate verify failed')],)",),)': /simple/opencv-python/
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError("bad handshake: Error([('rsa routines', 'INT_RSA_VERIFY', 'bad signature'), ('asn1 encoding routines', 'ASN1_item_verify', 'EVP lib'), ('SSL routines', 'ssl3_get_server_certificate', 'certificate verify failed')],)",),)': /simple/opencv-python/
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError("bad handshake: Error([('rsa routines', 'INT_RSA_VERIFY', 'bad signature'), ('asn1 encoding routines', 'ASN1_item_verify', 'EVP lib'), ('SSL routines', 'ssl3_get_server_certificate', 'certificate verify failed')],)",),)': /simple/opencv-python/
Could not fetch URL https://pypi.org/simple/opencv-python/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/opencv-python/ (Caused by SSLError(SSLError("bad handshake: Error([('rsa routines', 'INT_RSA_VERIFY', 'bad signature'), ('asn1 encoding routines', 'ASN1_item_verify', 'EVP lib'), ('SSL routines', 'ssl3_get_server_certificate', 'certificate verify failed')],)",),)) - skipping
Could not find a version that satisfies the requirement opencv-python (from versions: )
No matching distribution found for opencv-python
在上面的示例中,软件包opencv-python
可从https://pypi.org/project/opencv-python/
获得。我正在从Anaconda环境中使用Python 3.6。
此外,使用conda install <package>
会导致相同的错误:
conda search numpy
Loading channels: failed
CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://repo.anaconda.com/pkgs/free/noarch/repodata.json.bz2>
Elapsed: -
An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.
If your current network has https://www.anaconda.com blocked, please file
a support request with your network engineering team.
SSLError(MaxRetryError('HTTPSConnectionPool(host=\'repo.anaconda.com\', port=443): Max retries exceeded with url: /pkgs/free/noarch/repodata.json.bz2 (Caused by SSLError(SSLError("bad handshake: Error([(\'SSL routines\', \'tls_process_key_exchange\', \'bad signature\')],)",),))',),)
我不知道这是网络接口还是Python环境的问题?我已经尝试了所有发现的解决方案,但没有任何效果。
答案 0 :(得分:1)
我相信,如果您查看了VPC设置,就会发现您正在使用网络ACLS阻止外部IP地址。通常,这些用于控制VPC中子网之间的流量。
这是Amazon EC2上的常见错误。
查看您的设置将解决问题!
关于,
P.S。您的Python环境正常!
答案 1 :(得分:1)
请验证您实例的安全组是否允许到端口443的出站通信
答案 2 :(得分:0)
尝试在Windows 10中使用Network Reset
选项
它将删除所有已保存的WI-FI密码
答案 3 :(得分:0)
这是一个特定于 Windows 的答案,适用于面临与问题中描述的相同问题但在 Windows 机器上的任何人。截至目前,StackOverflow 上还没有针对 Windows 操作系统解决此问题的答案。
经过几天的搜索,我找到了这个!
第一步:按Win+R打开运行,输入“regedit”,点击确定。
第 2 步:移至 HKEY_CURRENT_USER/Software/Microsoft/Windows/Current Version/Internet Settings。
第 3 步:找到名为“ProxyServer”的文件并将其删除。
第 4 步:打开 cmd
第 5 步:发出命令“pip install flask-bcrypt”