【发布时间】:2017-06-23 23:39:53
【问题描述】:
我在 Ubuntu 14.04.5 上有 python 2.7.6 和 spyder 2.2.5。我无法连接到 Ipython 控制台,所以我决定更新 spyder:
pip install spyder --upgrade
它会引发以下错误。最上面的文字是:
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:318:SNIMissingWarning:已发出 HTTPS 请求,但 SNI(主题Name Indication) 对 TLS 的扩展在此平台上不可用。这可能会导致服务器提供不正确的 TLS 证书,从而导致验证失败。您可以升级到更新版本的 Python 来解决这个问题。如需更多信息,请参阅https://urllib3.readthedocs.io/en/latest/security.html#snimissingwarning。
完整的堆栈跟踪:
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#snimissingwarning.
SNIMissingWarning
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
Collecting spyder
Downloading spyder-3.1.4-py2-none-any.whl (3.5MB)
100% |████████████████████████████████| 3.5MB 387kB/s
Requirement already up-to-date: pygments>=2.0 in /usr/local/lib/python2.7/dist-packages (from spyder)
Requirement already up-to-date: jedi>=0.9.0 in /usr/local/lib/python2.7/dist-packages (from spyder)
Requirement already up-to-date: pyflakes in /usr/local/lib/python2.7/dist-packages (from spyder)
Requirement already up-to-date: pylint in /usr/local/lib/python2.7/dist-packages (from spyder)
Requirement already up-to-date: nbconvert in /usr/local/lib/python2.7/dist-packages (from spyder)
Requirement already up-to-date: qtpy>=1.1.0 in /usr/local/lib/python2.7/dist-packages (from spyder)
Requirement already up-to-date: pyzmq in /usr/local/lib/python2.7/dist-packages (from spyder)
Collecting numpydoc (from spyder)
Downloading numpydoc-0.6.0.tar.gz
Exception:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/usr/local/lib/python2.7/dist-packages/pip/commands/install.py", line 335, in run
wb.build(autobuilding=True)
File "/usr/local/lib/python2.7/dist-packages/pip/wheel.py", line 749, in build
self.requirement_set.prepare_files(self.finder)
File "/usr/local/lib/python2.7/dist-packages/pip/req/req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "/usr/local/lib/python2.7/dist-packages/pip/req/req_set.py", line 634, in _prepare_file
abstract_dist.prep_for_dist()
File "/usr/local/lib/python2.7/dist-packages/pip/req/req_set.py", line 129, in prep_for_dist
self.req_to_install.run_egg_info()
File "/usr/local/lib/python2.7/dist-packages/pip/req/req_install.py", line 412, in run_egg_info
self.setup_py, self.name,
File "/usr/local/lib/python2.7/dist-packages/pip/req/req_install.py", line 387, in setup_py
import setuptools # noqa
File "/usr/local/lib/python2.7/dist-packages/setuptools/__init__.py", line 12, in <module>
import setuptools.version
File "/usr/local/lib/python2.7/dist-packages/setuptools/version.py", line 1, in <module>
import pkg_resources
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 72, in <module>
import packaging.requirements
File "/usr/local/lib/python2.7/dist-packages/packaging/requirements.py", line 59, in <module>
MARKER_EXPR = originalTextFor(MARKER_EXPR())("marker")
TypeError: __call__() takes exactly 2 arguments (1 given)
我尝试安装一些其他软件包,如 ndg-httpsclient、urllib3[secure],但没有运气。它抛出完全相同的错误。我无法升级 python 本身。有人可以帮忙吗?
注意:我确实已经安装了python-dev libffi-dev libssl-dev。
【问题讨论】:
-
您有最新的
pip、setuptools和requests版本吗?也许也是更新python本身的好时机,2.7.6不是“当前”版本(2013年发布......),如果你想继续使用python-2,至少更新到2.7.13。 -
2.7.6 是 Ubuntu 14.04 的默认 python,我被告知不要乱用它。我的
pip已经是最新的(9.0.1),我已经将requests(到2.14.2)和setuptools更新到了最新版本。但是更新 spyder 还是有这个错误。 -
是的,您不需要更换系统 python。您可以使用
virtualenv或conda来管理单独的python 安装。但这些只是猜测,我从未见过我只是在消除可能的原因的错误(通常拥有最新的软件包并不是一个坏主意)。 :) -
你按照urllib3.readthedocs.io/en/latest/…的建议做了吗?还是您跳过了这一步?
-
@jww 我跟着它,
SNIMissingWarning和InsecurePlatformWarning警告消失了。但是错误仍然存在。