【问题标题】:After installing python with brew, I get an error with pip用 brew 安装 python 后,我得到一个 pip 错误
【发布时间】:2014-09-24 02:49:15
【问题描述】:

我正在使用 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

【问题讨论】:

    标签: python macos pip homebrew


    【解决方案1】:

    您是否尝试过使用 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 上运行)。 希望对您有所帮助!

    【讨论】:

      猜你喜欢
      • 2016-04-28
      • 2014-06-10
      • 2015-09-10
      • 1970-01-01
      • 1970-01-01
      • 2015-10-03
      • 2015-10-29
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多