簡體   English   中英

無法使用 pip 安裝任何軟件包

[英]Cannot install any package using pip

每當我嘗試通過pip install <package>從我的 Amazon EC2 實例pip install <package> ,我都會遇到以下問題:

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環境的問題? 我已經嘗試了我找到的所有解決方案,但沒有任何效果。

我相信,如果您查看 VPC 設置,您會發現您正在使用網絡 ACLS 阻止外部 IP 地址。 通常,這些用於控制 VPC 中子網之間的流量。

這是 Amazon EC2 上的常見錯誤。

查看您的設置將解決問題!

問候,🖖🏻

PS 你的 Python 環境工作正常!

請驗證您實例的安全組是否允許到端口 443 的出站流量

嘗試 Windows 10 中的Network Reset選項

  • 選項
  • 網絡與互聯網
  • 狀態選項卡
  • 查看頁面末尾(網絡重置)
  • 立即重置

它將刪除所有保存的 WI-FI 密碼

對於面臨與問題中描述的相同問題但在 Windows 機器上的任何人來說,這是一個特定Windows 的答案 截至目前,在 StackOverflow 上還沒有針對 Windows 操作系統解決此問題的答案。

經過幾天的搜索,我找到了這個!

第一步:按Win+R打開運行,輸入“regedit”,點擊確定。
第 2 步:移至 HKEY_CURRENT_USER/Software/Microsoft/Windows/Current Version/Internet Settings。
第 3 步:找到名為“ProxyServer”的文件並將其刪除。
第四步:打開cmd
第 5 步:啟動命令“pip install flask-bcrypt”

學分: https : //github.com/pypa/pip/issues/7424

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM