尝试使用pip安装Django时出错

时间:2015-05-05 15:38:16

标签: python ssl pip failed-installation

当我这样做时出现以下错误" pip install django"在OSX ......

Downloading/unpacking django
  Error <urlopen error [Errno 1] _ssl.c:504: error:0D0890A1:asn1 encoding routines:ASN1_verify:unknown message digest algorithm> while getting https://pypi.python.org/packages/source/D/Django/Django-1.8.1.tar.gz#md5=0f0a677a2cd56b9ab7ccb1c562d70f53 (from https://pypi.python.org/simple/django/)
Cleaning up...
Exception:
Traceback (most recent call last):
  File "/Users/garylewis/anaconda/lib/python2.7/site-packages/pip/basecommand.py", line 134, in main
    status = self.run(options, args)
  File "/Users/garylewis/anaconda/lib/python2.7/site-packages/pip/commands/install.py", line 236, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "/Users/garylewis/anaconda/lib/python2.7/site-packages/pip/req.py", line 1092, in prepare_files
    self.unpack_url(url, location, self.is_download)
  File "/Users/garylewis/anaconda/lib/python2.7/site-packages/pip/req.py", line 1238, in unpack_url
    retval = unpack_http_url(link, location, self.download_cache, self.download_dir)
  File "/Users/garylewis/anaconda/lib/python2.7/site-packages/pip/download.py", line 602, in unpack_http_url
    resp = _get_response_from_url(target_url, link)
  File "/Users/garylewis/anaconda/lib/python2.7/site-packages/pip/download.py", line 638, in _get_response_from_url
    resp = urlopen(target_url)
  File "/Users/garylewis/anaconda/lib/python2.7/site-packages/pip/download.py", line 176, in __call__
    response = self.get_opener(scheme=scheme).open(url)
  File "/Users/garylewis/anaconda/lib/python2.7/urllib2.py", line 404, in open
    response = self._open(req, data)
  File "/Users/garylewis/anaconda/lib/python2.7/urllib2.py", line 422, in _open
    '_open', req)
  File "/Users/garylewis/anaconda/lib/python2.7/urllib2.py", line 382, in _call_chain
    result = func(*args)
  File "/Users/garylewis/anaconda/lib/python2.7/site-packages/pip/download.py", line 155, in https_open
    return self.do_open(self.specialized_conn_class, req)
  File "/Users/garylewis/anaconda/lib/python2.7/urllib2.py", line 1184, in do_open
    raise URLError(err)
URLError: <urlopen error [Errno 1] _ssl.c:504: error:0D0890A1:asn1 encoding routines:ASN1_verify:unknown message digest algorithm>

Storing complete log in /var/folders/tv/mxmczdzd00bb3z5zkm6q1l400000gn/T/tmpYaAhkf

如何解决此问题并安装Django?我认为pip本身可能存在问题。我似乎记得过去无法安装其他Python的东西。

2 个答案:

答案 0 :(得分:3)

该错误似乎与SSL Python的证书有关here。由于Heartbleed已知错误而更新的证书。您需要更新/重新安装Python。

答案 1 :(得分:0)

我搜索问题并找到这个问题。但我发现这个问题没有解决办法。我分享我的解决方案如下:

  1. 如问题所示,使用了anaconda。请尝试使用 conda install 。如果返回HTTP 403,则与我的问题相同。我认为原因在于旧的anaconda版本。

  2. 解决此问题卸载anaconda并重新安装。我的系统是macOS。