我在运行pip install -U channels
时收到pypi.python.org
的证书错误。 我不知道问题是否与pip
或Python 3.6.0
或其他东西有关。 我尝试了以下建议,但都没有奏效。
pip --trusted-host pypi.python.org install -U channels
export PIP_CERT=/Users/user/Desktop/certificate_which_i_obtained_from_pypi_dot_python_dot_org.crt
pip install -U channels
下面的cacert.pem
是curl
的证书。
pip --cert /Users/user/cacert.pem install -U channels
我还怀疑这个问题可能与 Python 3.6.0 有关。 因为考虑以下输出:
user<strong i="25">@host</strong>:~$ python
Python 3.6.0 (v3.6.0:41df79263a11, Dec 22 2016, 17:23:13)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import ssl
>>> context = ssl.create_default_context()
>>> context.cert_store_stats()
{'x509': 0, 'crl': 0, 'x509_ca': 0}
>>> context.get_ca_certs()
[]
>>>
(virtualenv) user<strong i="29">@host</strong>:~/Documents/virtualenv$ pip install -U channels
Collecting channels
Using cached channels-0.17.3-py2.py3-none-any.whl
Collecting asgiref>=0.13 (from channels)
Using cached asgiref-1.0.0-py2.py3-none-any.whl
Collecting daphne>=0.14.1 (from channels)
Using cached daphne-0.15.0-py2.py3-none-any.whl
Requirement already up-to-date: Django>=1.8 in ./lib/python3.6/site-packages (from channels)
Collecting six (from asgiref>=0.13->channels)
Using cached six-1.10.0-py2.py3-none-any.whl
Collecting twisted>=16.0 (from daphne>=0.14.1->channels)
Using cached Twisted-16.6.0.tar.bz2
Complete output from command python setup.py egg_info:
Download error on https://pypi.python.org/simple/incremental/: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749) -- Some packages may not be found!
Couldn't find index page for 'incremental' (maybe misspelled?)
Download error on https://pypi.python.org/simple/: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749) -- Some packages may not be found!
No local packages or working download links found for incremental>=16.10.1
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/45/r4yr9bbj29dfbtxqv75_785m0000gn/T/pip-build-02d49zb3/twisted/setup.py", line 21, in <module>
setuptools.setup(**_setup["getSetupArgs"]())
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/core.py", line 108, in setup
_setup_distribution = dist = klass(attrs)
File "/Users/user/Documents/virtualenv/lib/python3.6/site-packages/setuptools/dist.py", line 316, in __init__
self.fetch_build_eggs(attrs['setup_requires'])
File "/Users/user/Documents/virtualenv/lib/python3.6/site-packages/setuptools/dist.py", line 371, in fetch_build_eggs
replace_conflicting=True,
File "/Users/user/Documents/virtualenv/lib/python3.6/site-packages/pkg_resources/__init__.py", line 846, in resolve
dist = best[req.key] = env.best_match(req, ws, installer)
File "/Users/user/Documents/virtualenv/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1118, in best_match
return self.obtain(req, installer)
File "/Users/user/Documents/virtualenv/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1130, in obtain
return installer(requirement)
File "/Users/user/Documents/virtualenv/lib/python3.6/site-packages/setuptools/dist.py", line 439, in fetch_build_egg
return cmd.easy_install(req)
File "/Users/user/Documents/virtualenv/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 668, in easy_install
raise DistutilsError(msg)
distutils.errors.DistutilsError: Could not find suitable distribution for Requirement.parse('incremental>=16.10.1')
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/45/r4yr9bbj29dfbtxqv75_785m0000gn/T/pip-build-02d49zb3/twisted/
(virtualenv) user<strong i="30">@host</strong>:~/Documents/virtualenv$
我也有这个问题。
问题似乎源于构建 Python 3.6.0 时未启用 ssl 模块。
我通过取消注释 Python-3.6.0/Modules/Setup 中的第 209-212 行来解决这个问题
SSL=/usr/local/ssl
_ssl _ssl.c \
-DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
-L$(SSL)/lib -lssl -lcrypto
并确保libssl-dev
已安装(无论如何,这是 debian 的软件包)。
完成后,再次执行./configure
、 make
和make install
,它应该可以工作。
我在最新的 OSX 的 Python 3.5 上遇到了完全相同的问题:
$ pip install pip --upgrade
Could not fetch URL https://pypi.python.org/simple/pip/: There was a problem confirming the ssl certificate: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:720) - skipping
我通过使用受信任的主机参数修复它:
$ pip install --trusted-host pypi.python.org pip --upgrade
Requirement already up-to-date: pip in ./venv/lib/python3.5/site-packages
我不会把--trusted-host
称为修复。 充其量这是一个危险的解决方法。 您正在禁用 TLS 验证并打开您的计算机以进行中间人攻击。 该选项应该被称为--bypass-insecure-host
或类似名称。
这里的问题是 setuptools 试图与 PyPI 对话,而不是 pip,并且 macOS 上的 3.6.0 默认情况下无法访问 CA Bundle,并且 setuptools 不像 pip 那样捆绑一个。 您需要安装诸如 certifi 之类的东西或使用 setuptools 提出问题。
点安装增量
你是英雄@CallenChen
还是不行,求大神帮忙。。。
C:\Windows\system32>pip 安装增量
收集增量
无法获取 URL https://pypi.python.org/simple/incremental/ :确认 ssl 证书时出现问题:[SSL: CERTIFICATE_VERIFY_FAILED] 证书验证失败 (_ssl.c:748) - 跳过
找不到满足增量要求的版本(来自版本:)
未找到增量的匹配分布
在 OSX 上,使用 macport,安装 curl-ca-bundle 解决了它:
sudo 端口安装 curl-ca-bundle
酿造更新
冲泡卸载openssl
冲泡安装openssl
echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile
像这里提到的那样安装 certifi 怎么样(这个链接在安装 Python 3.6 后很快出现)?
pip install certifi
@gitanupam安装证书对我有用。
没有一个解决方案对我有用。 我在 OSX
尝试使用 get-pip.py 直接安装新版本的 pip(参见 https://pip.pypa.io/en/stable/installing/)
$ curl 'https://bootstrap.pypa.io/get-pip.py' > get-pip.py
$ sudo python get-pip.py
(由@pradyunsg 格式化)
@sdk21这对我
不知道为什么,也许是因为 Pypi 不再接受 http 连接......但改变镜像对我有用:
$ cat ~/.config/pip/pip.conf
[global]
proxy = http://my-proxy:8080
index-url = http://mirrors.aliyun.com/pypi/simple/
trusted-host = mirrors.aliyun.com
PyPI 正在接受 HTTP 连接,但最近停止了对 TLS v1.0 和 v1.1 的支持。 见https://stackoverflow.com/a/49769015/1526703
感谢您的澄清, @gitanupam
谢谢@sdk21! 这个对我有用!
@sdk21这对我有用。 谢谢!
@sdk21这对我有用。 谢谢!
谢谢@sdk21解决它...
在mac上,我这样做了,最后解决了:
https://pip.readthedocs.io/en/stable/installing/
@sdk21谢谢,它对我有用👍
最有用的评论
尝试使用 get-pip.py 直接安装新版本的 pip(参见 https://pip.pypa.io/en/stable/installing/)
(由@pradyunsg 格式化)