我无法让pip更新任何包。这是OpenSSL的问题吗?

2024-09-25 00:24:08 发布

您现在位置:Python中文网/ 问答频道 /正文

当我运行pip install CryptContextpip install ssl命令时,我得到以下消息:

Downloading/unpacking ssl
Cannot fetch index base URL https://pypi.python.org/simple/
Could not find any downloads that satisfy the requirement ssl
Cleaning up...
No distributions at all found for ssl
Storing debug log for failure in /Users/chauncey/.pip/pip.log
Chaunceys-MacBook-Pro-2:dist chauncey$ pip install CryptContext
Downloading/unpacking CryptContext
  Cannot fetch index base URL https://pypi.python.org/simple/
  Could not find any downloads that satisfy the requirement CryptContext
Cleaning up...
No distributions at all found for CryptContext
Storing debug log for failure in /Users/chauncey/.pip/pip.log

当我查看pip.log文件时,我得到以下信息:

/Library/Frameworks/Python.framework/Versions/2.7/bin/pip run on Sun Dec  1 20:45:23 2019
Downloading/unpacking CryptContext
  Getting page https://pypi.python.org/simple/CryptContext/
  Could not fetch URL https://pypi.python.org/simple/CryptContext/: connection error: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:581)
  Will skip URL https://pypi.python.org/simple/CryptContext/ when looking for download links for CryptContext
  Getting page https://pypi.python.org/simple/
  Could not fetch URL https://pypi.python.org/simple/: connection error: HTTPSConnectionPool(host='pypi.python.org', port=443): Max retries exceeded with url: /simple/ (Caused by <class 'httplib.CannotSendRequest'>: )
  Will skip URL https://pypi.python.org/simple/ when looking for download links for CryptContext
  Cannot fetch index base URL https://pypi.python.org/simple/
  URLs to search for versions for CryptContext:
  * https://pypi.python.org/simple/CryptContext/
  Getting page https://pypi.python.org/simple/CryptContext/
  Could not fetch URL https://pypi.python.org/simple/CryptContext/: connection error: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:581)
  Will skip URL https://pypi.python.org/simple/CryptContext/ when looking for download links for CryptContext
  Could not find any downloads that satisfy the requirement CryptContext

我把范围缩小到这一行:

Could not fetch URL https://pypi.python.org/simple/CryptContext/: connection error: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:581)

然后我运行以下命令:

sudo mv /usr/bin/openssl /usr/bin/openssl_old
sudo ln -s /usr/local/Cellar/openssl/1.0.2g/bin/openssl /usr/bin/openssl

在此之后,我运行openssl version -a并得到以下结果:

OpenSSL 1.0.2g  1 Mar 2016

built on: reproducible build, date unspecified
platform: darwin64-x86_64-cc
options:  bn(64,64) rc4(ptr,int) des(idx,cisc,16,int) idea(int) blowfish(idx) 
compiler: clang -I. -I.. -I../include  -fPIC -fno-common -DOPENSSL_PIC -DZLIB_SHARED -DZLIB -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -arch x86_64 -O3 -DL_ENDIAN -Wall -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM -DECP_NISTZ256_ASM
OPENSSLDIR: "/usr/local/etc/openssl"

但是,当我检查pip.log文件时,他们仍然在说上面指定的相同错误。你知道吗

我的Mac电脑很旧了。是Version 10.7.6。你知道吗


Tags: piphttpsorgpypilogurlsslfor