`pip` вдруг ломается? with `pip настроен на места, которые требуют TLS / SSL, однако модуль ssl в Python недоступен. - PullRequest
1 голос
/ 29 марта 2020

Примечание .
Я знаю, что в этом очень важном посте было предложено много решений, но все они очень разные и предполагают совершенно разные проблемы, и я не хочу слепо попробовать один случайный случай, просто чтобы посмотреть, что происходит.

Проблема .
Я работал над Jupiter notebook, когда я начал получать ошибки (с ядром, не могу точно помню, что именно сейчас). После нескольких попыток и поиска в сети, похоже, проблема в том, что pip как-то сломался. А именно, я получаю

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

Сообщение об ошибке. Некоторое дальнейшее чтение предполагает, что проблема с homebrew?

Это озадачивает меня по двум причинам:
- я не вижу, что я сделал, что сломалось pip;
- pip для все моих виртуальных сред кажутся сломанными.

В чем на самом деле проблема и откуда она возникает?

Настройка .
- macOS Catalina 10.15.3.
- pyenv as Python менеджер виртуальной среды - ниже приведены значения для Python и pip версий

Некоторые выходы .
Команда pip --version с python3.8.2 очень странная , Проходя через site-packages установки python3.8.2, похоже, что pip версия 19.2.3.

Ошибки не совсем одинаковые для разных версий pip.

$ pyenv local 3.6.7 && pip --version && pip list
pip 10.0.1 from /Users/antoine/.pyenv/versions/3.6.7/lib/python3.6/site-packages/pip (python 3.6)
# prints list correctly
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
$ pyenv local 3.7.1 && pip --version && pip list
pip 10.0.1 from /Users/antoine/.pyenv/versions/3.7.1/lib/python3.7/site-packages/pip (python 3.7)
# prints list correctly
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
$ pyenv local 3.7.4 && pip --version && pip list
pip 19.3.1 from /Users/antoine/.pyenv/versions/3.7.4/lib/python3.7/site-packages/pip (python 3.7)
# prints list correctly
WARNING: 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
$ pyenv local 3.8.2 && pip --version # produces error, no need to try `pip list`
# prints something that looks like ImageMagick help documentation
By default, 'file' is written in the MIFF image format.  To
specify a particular image format, precede the filename with an image
format name and a colon (i.e. ps:image) or specify the image type as
the filename suffix (i.e. image.ps).  Specify 'file' as '-' for
standard input or output.
import: delegate library support not built-in '' (X11) @ error/import.c/ImportImageCommand/1282.
from: can't read /var/mail/pip._internal
/Users/antoine/.pyenv/versions/3.8.2/bin/pip: line 9: syntax error near unexpected token `('
/Users/antoine/.pyenv/versions/3.8.2/bin/pip: line 9: `    sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])'
...