pip安装但在安装任何软件包时抛出错误

时间:2014-02-10 12:42:42

标签: python django python-2.7 pip

pip已安装在我的系统上,但每当我尝试安装任何软件包时,它都会抛出异常。安装每个包都有同样的例外。我无法在网上找到这个。请帮忙。

pip install django-social-auth
Downloading/unpacking django-social-auth
Cleaning up...
Exception:
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pip-1.5.2-py2.7.egg/pip/basecommand.py", line 122, in main
   status = self.run(options, args)
  File "/Library/Python/2.7/site-packages/pip-1.5.2-py2.7.egg/pip/commands/install.py", line 274, in run
   requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "/Library/Python/2.7/site-packages/pip-1.5.2-py2.7.egg/pip/req.py", line 1166, in prepare_files
   url = finder.find_requirement(req_to_install, upgrade=self.upgrade)
 File "/Library/Python/2.7/site-packages/pip-1.5.2-py2.7.egg/pip/index.py", line 194, in find_requirement
  page = self._get_page(main_index_url, req)
 File "/Library/Python/2.7/site-packages/pip-1.5.2-py2.7.egg/pip/index.py", line 568, in _get_page
  session=self.session,
 File "/Library/Python/2.7/site-packages/pip-1.5.2-py2.7.egg/pip/index.py", line 670, in get_page
   resp = session.get(url, headers={"Accept": "text/html"})
 File "/Library/Python/2.7/site-packages/pip-1.5.2-py2.7.egg/pip/_vendor/requests/sessions.py", line 395, in get
   return self.request('GET', url, **kwargs)
 File "/Library/Python/2.7/site-packages/pip-1.5.2-py2.7.egg/pip/download.py", line 237, in request
   return super(PipSession, self).request(method, url, *args, **kwargs)
  File "/Library/Python/2.7/site-packages/pip-1.5.2-py2.7.egg/pip/_vendor/requests/sessions.py", line 356, in request
    env_proxies = get_environ_proxies(url) or {}
  File "/Library/Python/2.7/site-packages/pip-1.5.2-py2.7.egg/pip/_vendor/requests/utils.py", line 504, in get_environ_proxies
    bypass = proxy_bypass(netloc)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib.py", line 1433, in proxy_bypass
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib.py", line 1413, in proxy_bypass_macosx_sysconf
ValueError: negative shift count

3 个答案:

答案 0 :(得分:3)

urllib使用的pip模块将自动从您的操作系统加载代理配置。

在这种情况下,这会失败,因为您在代理绕过字段中似乎有一些格式错误的代理配置。验证您的代理配置是否正确。在Mac上,在“系统偏好设置”下执行此操作>网络

答案 1 :(得分:0)

绕过代理设置主机部分。我删除了它们,现在工作正常。 ----这对我也有用

答案 2 :(得分:0)

如果@Martijn Pieters的回答没有为您解决,请务必选中“绕过代理设置主机”部分。

尝试删除该字段中的地址,点击应用更改,然后重试。