2014-02-10 151 views
3

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 
+1

您在Mac OS X中配置了哪些代理(在系統偏好設置>網絡下)。 –

+0

無。我沒有使用任何代理 – Pooja

+0

我沒有說過;但是會拋出異常,因爲'urllib'會從您的操作系統加載代理配置。 –

回答

3

使用pip會自動從您的OS加載代理配置的urllib模塊。

在這種情況下,這會失敗,因爲您在代理旁路字段中似乎有一些格式錯誤的代理配置。驗證您的代理配置是否正確。在Mac上,在系統偏好設置>網絡下執行此操作。

0

跳過代理設置hosts部分。我刪除了它們,現在工作正常。 ----這對我也有幫助

0

如果@Martijn Pieters的回答沒有爲您解決問題,請務必檢查「繞過代理設置主機」部分。

嘗試刪除該字段中的地址,然後點擊應用更改並重試。