用brew安装python后,我得到一个pip错误

时间:2014-09-24 02:49:15

标签: python macos pip homebrew

我正在使用OSX(最新版本,10.9.5),一个新的Macbook Pro。试图用brew安装python:

$ brew install python
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/python-2.7.8_1.mavericks.bottle.2.tar.gz
Already downloaded: /Library/Caches/Homebrew/python-2.7.8_1.mavericks.bottle.2.tar.gz
==> Pouring python-2.7.8_1.mavericks.bottle.2.tar.gz
==> Caveats
Setuptools and Pip have been installed. To update them
  pip install --upgrade setuptools
  pip install --upgrade pip

You can install Python packages with
  pip install <package>

They will install into the site-package directory
  /usr/local/lib/python2.7/site-packages
Press ENTER or type command to continue


See: https://github.com/Homebrew/homebrew/wiki/Homebrew-and-Python

.app bundles were installed.
Run `brew linkapps` to symlink these to /Applications.
Press ENTER or type command to continue

==> /usr/local/Cellar/python/2.7.8_1/bin/python -s setup.py --no-user-cfg install --force --verbose --install-scripts=/usr/local/Cellar/python/2.7.8_1/bin --install-lib=/usr/local/lib/python2.7/site-packa
==> /usr/local/Cellar/python/2.7.8_1/bin/python -s setup.py --no-user-cfg install --force --verbose --install-scripts=/usr/local/Cellar/python/2.7.8_1/bin --install-lib=/usr/local/lib/python2.7/site-packa
==> Summary
  /usr/local/Cellar/python/2.7.8_1: 4776 files, 76M

然后我尝试运行pip并收到错误:

$ pip list
Traceback (most recent call last):
  File "/usr/local/bin/pip", line 5, in <module>
    from pkg_resources import load_entry_point
ImportError: No module named pkg_resources

1 个答案:

答案 0 :(得分:0)

您是否尝试过使用easy_install安装pip?像这样:

$sudo easy_install pip
...
$pip -V
$pip 1.5.6 from /Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg (python 2.7)

这应该有效(我已经尝试过,它可以在我的MacBook上运行)。 希望它有所帮助!