由于SNI警告而导致无法更新spyder

时间:2017-05-10 17:18:51

标签: python openssl spyder

我在Ubuntu 14.04.5上使用spyder 2.2.5的python 2.7.6。我无法连接到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(主题名称指示)此平台不提供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-httpsclienturllib3[secure],但没有运气。它抛出完全相同的错误。我不能升级python本身。有人可以帮忙吗?

注意:我已经安装了python-dev libffi-dev libssl-dev

1 个答案:

答案 0 :(得分:0)

事实证明我的requirements.py有问题(如错误所示)。我不知道它是否会造成未来的伤害,但在MARKER_EXPR()函数中添加一个空字符串会修复它。

  

MARKER_EXPR = originalTextFor(MARKER_EXPR(&#34;&#34;))(&#34; marker&#34;)