0

我在 ubuntu 精确系统上安装了 pythonbrew。在安装过程中使用代理遇到了一些问题(请参阅之前的帖子)。现在我可以安装不同版本的 python 并在它们之间切换,但是在 python 安装过程中没有安装 setuptools:

ERROR: Failed to install setuptools. See /usr/local/pythonbrew/log/build.log to see why.
Skip installation of setuptools.

build.log 包含:

Downloading http://pypi.python.org/packages/source/d/distribute/distribute-0.6.49.tar.gz
Traceback (most recent call last):
File "distribute_setup.py", line 556, in <module>
  sys.exit(main())
File "distribute_setup.py", line 552, in main
  tarball = download_setuptools(download_base=options.download_base)
File "distribute_setup.py", line 211, in download_setuptools
  src = urlopen(url)
File "/usr/local/pythonbrew/pythons/Python-2.6/lib/python2.6/urllib2.py", line 124, in urlopen
  return _opener.open(url, data, timeout)
File "/usr/local/pythonbrew/pythons/Python-2.6/lib/python2.6/urllib2.py", line 389, in open
  response = meth(req, response)
File "/usr/local/pythonbrew/pythons/Python-2.6/lib/python2.6/urllib2.py", line 502, in http_response
  'http', request, response, code, msg, hdrs)
File "/usr/local/pythonbrew/pythons/Python-2.6/lib/python2.6/urllib2.py", line 421, in error
  result = self._call_chain(*args)
File "/usr/local/pythonbrew/pythons/Python-2.6/lib/python2.6/urllib2.py", line 361, in _call_chain
result = func(*args)
File "/usr/local/pythonbrew/pythons/Python-2.6/lib/python2.6/urllib2.py", line 597, in http_error_302
  return self.parent.open(new)
File "/usr/local/pythonbrew/pythons/Python-2.6/lib/python2.6/urllib2.py", line 383, in open
  response = self._open(req, data)
File "/usr/local/pythonbrew/pythons/Python-2.6/lib/python2.6/urllib2.py", line 401, in _open
  '_open', req)
File "/usr/local/pythonbrew/pythons/Python-2.6/lib/python2.6/urllib2.py", line 361, in _call_chain
  result = func(*args)
File "/usr/local/pythonbrew/pythons/Python-2.6/lib/python2.6/urllib2.py", line 1138, in https_open
  return self.do_open(httplib.HTTPSConnection, req)
File "/usr/local/pythonbrew/pythons/Python-2.6/lib/python2.6/urllib2.py", line 1105, in do_open
  raise URLError(err)
urllib2.URLError: <urlopen error [Errno 110] Connection timed out>

在我看来,问题又出在代理上,我不确定要修改什么脚本,以便 setuptools 安装使用我的代理。我修改了distribute_setup.py 并在那里添加了代理信息(基于这篇文章),但看起来这个文件在每次调用pythonbrew install 时都会被覆盖。我是 python 新手,找不到这个文件是从哪里生成的。任何关于如何将代理传递给安装的 setuptools 部分的指针将不胜感激。

4

1 回答 1

0

在 env 中设置 HTTP_PROXY 和 HTTPS_PROXY 解决了这个特殊问题(之后错误从 110 变为 113;后续请参见 this other question)。

于 2013-09-25T00:25:59.227 回答