我正在尝试在新的Django项目中使用pipenv
。但是,如果我尝试pipenv install django
,则会收到确认SSL证书的错误消息:
Kurts-MacBook-Pro:wemap kurtpeek$ pipenv install django
Installing django...
Collecting django
Could not fetch URL https://pypi.python.org/simple/django/: There was a problem confirming the ssl certificate: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:590) - skipping
Error: An error occurred while installing django!
Could not find a version that satisfies the requirement django (from versions: )
No matching distribution found for django
我最近运行过brew upgrade
;这是我的Pipenv和Python版本:
Kurts-MacBook-Pro:wemap kurtpeek$ pipenv --version
pipenv, version 2018.7.1
Kurts-MacBook-Pro:wemap kurtpeek$ python --version
Python 3.7.0
我已经尝试了Not able to install Python packages [SSL: TLSV1_ALERT_PROTOCOL_VERSION]的答案,但这基本上没有任何作用,因为我的pip
版本已经是最新的了:
Kurts-MacBook-Pro:wemap kurtpeek$ curl https://bootstrap.pypa.io/get-pip.py | python
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1604k 100 1604k 0 0 583k 0 0:00:02 0:00:02 --:--:-- 583k
Collecting pip
Using cached https://files.pythonhosted.org/packages/5f/25/e52d3f31441505a5f3af41213346e5b6c221c9e086a166f3703d2ddaf940/pip-18.0-py2.py3-none-any.whl
Installing collected packages: pip
Found existing installation: pip 18.0
Uninstalling pip-18.0:
Successfully uninstalled pip-18.0
Successfully installed pip-18.0
我正在运行MacOS Sierra版本10.12.6,因此这确实确实是由'pip install' fails for every package ("Could not find a version that satisfies the requirement")中所述的TLS 1.0弃用问题引起的。但是如何补救呢?
答案 0 :(得分:0)
最后,我通过将Macbook Pro升级到macOS High Sierra(版本10.13.6)解决了这一问题。现在我可以pipenv install django
了:
Kurts-MacBook-Pro:wemap kurtpeek$ pipenv install django
Creating a Pipfile for this project...
Installing django...
Requirement already satisfied: django in /Users/kurtpeek/.local/share/virtualenvs/wemap-X_Ia-lVq/lib/python2.7/site-packages
Requirement already satisfied: pytz in /Users/kurtpeek/.local/share/virtualenvs/wemap-X_Ia-lVq/lib/python2.7/site-packages (from django)
Adding django to Pipfile's [packages]...
Pipfile.lock not found, creating...
Locking [dev-packages] dependencies...
Locking [packages] dependencies...
Updated Pipfile.lock (71a00b)!
Installing dependencies from Pipfile.lock (71a00b)...
▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 2/2 — 00:00:00
To activate this project's virtualenv, run pipenv shell.
Alternatively, run a command inside the virtualenv with pipenv run.