9

我在为通过 pythonbrew 安装的 python 2.7.3 安装 pip 时遇到问题:

pythonbrew update --master
pythonbrew install 2.7.3 --force

在尝试从 pip.openplans.org 获取 pip 时,这在最后阶段挂起时失败:

Installed /Users/andrei/.pythonbrew/pythons/Python-2.7.3/lib/python2.7/site-packages/distribute-0.6.28-py2.7.egg
Processing dependencies for distribute==0.6.28
Finished processing dependencies for distribute==0.6.28
After install bootstrap.
Don't have permissions to write /Users/andrei/.pythonbrew/pythons/Python-2.7.3/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg-info, skipping
Creating /Users/andrei/.pythonbrew/pythons/Python-2.7.3/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg-info
Creating /Users/andrei/.pythonbrew/pythons/Python-2.7.3/lib/python2.7/site-packages/setuptools.pth
Searching for pip
Reading http://pypi.python.org/simple/pip/
Reading http://pip.openplans.org
Download error on http://pip.openplans.org: [Errno 8] nodename nor servname provided, or not known -- Some packages may not be found!
Reading http://pip.openplans.org
Download error on http://pip.openplans.org: [Errno 8] nodename nor servname provided, or not known -- Some packages may not be found!
Reading http://pip.openplans.org
...

运行easy_install pip也会导致同样的错误。当然,我仍然可以克隆piprepo 并手动安装它,但很高兴知道它为什么会通过easy_install. 任何的想法?


更新:

$ host pip.openplans.org
pip.openplans.org is an alias for puffin.oddbird.net.
puffin.oddbird.net has address 173.203.85.138
4

3 回答 3

13

我有类似的问题;该命令在 iTerm2 中失败,但在默认的 OS X 终端中没有。重启 iTerm2 解决了这个问题。

于 2016-08-15T16:15:42.200 回答
6

有两件事可能是错误的:

  • DNS 查找失败pip.openplans.org;测试host pip.openplans.org。这可能是本地问题;host pip.openplans.org 8.8.8.8也使用和对 Google DNS 服务器进行测试host pip.openplans.org 8.8.4.4。如果所有这些查找都失败了,那就祭出一只鸡给互联网大神,等待改进。

  • 如果 DNS 查找没有失败,但安装失败了,那么您的本地 DNS 缓存可能会持续进行否定查找。用命令刷新它dscacheutil -flushcache

于 2012-08-13T09:51:01.573 回答
2

对我来说,打开和关闭 WiFi 有助于 Max OS X Yosemite。

于 2015-03-03T10:57:17.363 回答