2012-12-14 181 views
4

連接復位當我嘗試使用PIP我有例外「連接被對方​​復位」安裝LXML:PIP安裝 - 通過對

Downloading/unpacking lxml 
    Downloading lxml-3.0.1.tar.gz (3.2Mb): 643Kb downloaded 
Exception: 
Traceback (most recent call last): 
    File "/home/dummyuser/work/virt-dev-env/local/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/basecommand.py", line 104, in main 
    status = self.run(options, args) 
    File "/home/dummyuser/work/virt-dev-env/local/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/commands/install.py", line 245, in run 
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle) 
    File "/home/dummyuser/work/virt-dev-env/local/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/req.py", line 985, in prepare_files 
    self.unpack_url(url, location, self.is_download) 
    File "/home/dummyuser/work/virt-dev-env/local/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/req.py", line 1109, in unpack_url 
    retval = unpack_http_url(link, location, self.download_cache, self.download_dir) 
    File "/home/dummyuser/work/virt-dev-env/local/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/download.py", line 451, in unpack_http_url 
    download_hash = _download_url(resp, link, temp_location) 
    File "/home/dummyuser/work/virt-dev-env/local/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/download.py", line 368, in _download_url 
    chunk = resp.read(4096) 
    File "/usr/lib/python2.7/socket.py", line 380, in read 
    data = self._sock.recv(left) 
    File "/usr/lib/python2.7/httplib.py", line 561, in read 
    s = self.fp.read(amt) 
    File "/usr/lib/python2.7/socket.py", line 380, in read 
    data = self._sock.recv(left) 
error: [Errno 104] Connection reset by peer 

這只是發生在安裝lxml的時候,其他模塊得到安裝了點子沒有問題。任何人都有同樣的問題?

+0

你可以嘗試http://stackoverflow.com/questions/10547332/install-m2crypto-on-a-virtualenv-without-system-packages/10547858#10547858 – Denis

+0

試圖安裝它在我的全球環境中有同樣的問題。 – Shengjie

+1

你應該嘗試一下你的OS包管理器像apt-get安裝python-lxml – Denis

回答

2

原來我用莫名其妙的鏡子不能從訪問網絡。我與它得到周圍的方式是直接使用通過OS安裝它:

$ apt-get install python-lxml 

然後將其複製到我的虛擬ENV:

$ cp -r /usr/lib/python2.7/dist-packages/lxml* /home/dummyuser/work/virt-dev-env/local/lib/python2.7/site-packages/ 

然後我有它在我的虛擬ENV:

$ pip freeze 
........ 
lxml==2.3.2 
........ 
7

儘量選擇其他的PyPI鏡,無論是直接:

pip install -i http://e.pypi.python.org/simple lxml 

或者通過讓pip找到最好的鏡子:

pip install --use-mirrors lxml 
+0

是啊,現在甚至只是嘗試從pypi.python.org/simple下載它,我打網絡錯誤。我猜鏡子本身有問題。 – Shengjie

+1

@ Shengjie如果* all * [PyPI mirrors](http://pypi.python.org/mirrors)失敗,那麼網絡結束時就會出現問題。 – lunaryorn

+0

我收到很多「找不到滿足要求XX的版本」 –

1

在我的情況,是一個ipv6問題。一些鏡像仍然沒有完整的ipv6訪問權限。

禁用ipv6並重試。

+0

我該怎麼做? – linqu

+0

搜索如何在操作系統中禁用ipv6。 –