简体   繁体   English

尝试使用pip安装Django时出错

[英]Error trying to install Django with pip

I get the following error when I do "pip install django" in OSX... 在OSX中执行“ pip install django”时,出现以下错误...

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

How do I resolve this and install Django? 我该如何解决并安装Django? I think it might be a problem with pip itself. 我认为点子本身可能是一个问题。 I seem to recall being unable to install other Python stuff in the past with it. 我似乎记得过去无法使用它来安装其他Python东西。

The error seems related the SSL Python's certificate as stated here . 该错误似乎与此处所述的SSL Python证书有关。 Certificates where updated because of the Heartbleed known bug. 由于已知Heartbleed错误而更新了证书。 You need to update/reinstall your Python. 您需要更新/重新安装Python。

I search the problem and find this question. 我搜索问题并找到此问题。 But I find there is no solution for this problem. 但是我发现这个问题没有解决方案。 I share my solution as follows: 我分享我的解决方案如下:

  1. As shown in the question, anaconda is used. 如问题所示,使用了蟒蛇。 Please try to use the conda install . 请尝试使用conda install If return HTTP 403, you have the same problem as mine. 如果返回HTTP 403,则与我的问题相同。 I think the reason lies in the old anaconda version. 我认为原因在于旧的anaconda版本。

  2. I solve this problem by uninstall the anaconda and reinstall it. 我通过卸载anaconda并重新安装来解决此问题 My system is macOS. 我的系统是macOS。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM