点安装-由对等方重置连接 [英] pip install - Connection reset by peer

查看:126
本文介绍了点安装-由对等方重置连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试使用pip安装lxml时,出现了异常对等连接重置":

When I try to install lxml using pip I had the exception "Connection reset by peer":

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时发生,使用pip安装其他模块没有问题.有人有同样的问题吗?

This only happened when installing lxml, other modules got installed with pip no problems. Anybody had the same problem?

推荐答案

事实证明,我无法以某种方式从网络访问我正在使用的镜像.我解决这个问题的方法是直接使用以下方法通过OS进行安装:

It turns out the mirror I was using somehow is not accessible from the network. The way I got around with it is installing it via OS directly using:

$ apt-get install python-lxml

然后将其复制到我的虚拟环境中:

then copy it to my virtual env:

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

然后我将其保存在虚拟环境中

I then have it in my virtual env:

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

这篇关于点安装-由对等方重置连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆