【问题标题】:Homebrew Python not installing setuptoolsHomebrew Python没有安装setuptools
【发布时间】:2023-03-31 19:36:01
【问题描述】:

这一切都在 iMac OSX 10.9.2 上

在进行 python2.7 的 Homebrew 安装时,一切似乎都在正确创建。但是,在完成并尝试使用 pip 或 easy_install 进行任何操作后,我不断收到以下错误:

$ pip install virtualenv
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

我已尝试卸载并重新安装 Brewed python,结果相同。我还使用 -v 运行了安装,结果如下:

==> Verifying python-2.7.6.mavericks.bottle.tar.gz checksum
==> Pouring python-2.7.6.mavericks.bottle.tar.gz
tar xf /Library/Caches/Homebrew/python-2.7.6.mavericks.bottle.tar.gz
==> Caveats
Python demo
  /usr/local/share/python/Extras

Setuptools and Pip have been installed. To update them
  pip install --upgrade setuptools
  pip install --upgrade pip

You can install Python packages with (the outdated easy_install or)
  `pip install <your_favorite_package>`

They will install into the site-package directory
  /usr/local/lib/python2.7/site-packages

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

.app bundles were installed.
Run `brew linkapps` to symlink these to /Applications.
==> Finishing up
ln -s ../Cellar/python/2.7.6/bin/smtpd2.py smtpd2.py
ln -s ../Cellar/python/2.7.6/bin/smtpd2.7.py smtpd2.7.py
ln -s ../Cellar/python/2.7.6/bin/smtpd.py smtpd.py
ln -s ../Cellar/python/2.7.6/bin/pythonw2.7 pythonw2.7
ln -s ../Cellar/python/2.7.6/bin/pythonw2 pythonw2
ln -s ../Cellar/python/2.7.6/bin/pythonw pythonw
ln -s ../Cellar/python/2.7.6/bin/python2.7-config python2.7-config
ln -s ../Cellar/python/2.7.6/bin/python2.7 python2.7
ln -s ../Cellar/python/2.7.6/bin/python2-config python2-config
ln -s ../Cellar/python/2.7.6/bin/python2 python2
ln -s ../Cellar/python/2.7.6/bin/python-config python-config
ln -s ../Cellar/python/2.7.6/bin/python python
ln -s ../Cellar/python/2.7.6/bin/pydoc2.7 pydoc2.7
ln -s ../Cellar/python/2.7.6/bin/pydoc2 pydoc2
ln -s ../Cellar/python/2.7.6/bin/pydoc pydoc
ln -s ../Cellar/python/2.7.6/bin/pip2.7 pip2.7
ln -s ../Cellar/python/2.7.6/bin/pip2 pip2
ln -s ../Cellar/python/2.7.6/bin/pip pip
ln -s ../Cellar/python/2.7.6/bin/idle2.7 idle2.7
ln -s ../Cellar/python/2.7.6/bin/idle2 idle2
ln -s ../Cellar/python/2.7.6/bin/idle idle
ln -s ../Cellar/python/2.7.6/bin/easy_install-2.7 easy_install-2.7
ln -s ../Cellar/python/2.7.6/bin/easy_install easy_install
ln -s ../Cellar/python/2.7.6/bin/2to3-2.7 2to3-2.7
ln -s ../Cellar/python/2.7.6/bin/2to3-2 2to3-2
ln -s ../Cellar/python/2.7.6/bin/2to3 2to3
ln -s ../Cellar/python/2.7.6/share/python python
ln -s ../../../Cellar/python/2.7.6/share/man/man1/python2.7.1 python2.7.1
ln -s ../../../Cellar/python/2.7.6/share/man/man1/python2.1 python2.1
ln -s ../../../Cellar/python/2.7.6/share/man/man1/python.1 python.1
ln -s ../../../Cellar/python/2.7.6/Frameworks/Python.framework/Versions/Current Current
ln -s ../../../Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7 2.7
ln -s ../../Cellar/python/2.7.6/Frameworks/Python.framework/Resources Resources
ln -s ../../Cellar/python/2.7.6/Frameworks/Python.framework/Python Python
ln -s ../../Cellar/python/2.7.6/Frameworks/Python.framework/Headers Headers
ln -s ../../Cellar/python/2.7.6 python
ln -s ../Cellar/python/2.7.6 python
==> Summary
????  /usr/local/Cellar/python/2.7.6: 3790 files, 59M

我注意到 Homebrew Python 页面指出“brew install python”应该在“/usr/local/lib/python2.7/site-packages”创建一个站点包文件夹。但是,当我导航到“/usr/local/lib”并使用“ls -a”时,没有与 python 相关的文件夹。

brew doctor 没有报告错误

提前感谢您,请让我知道可能需要哪些其他信息。

【问题讨论】:

    标签: python-2.7 homebrew osx-mavericks


    【解决方案1】:

    万一其他人遇到这种情况,我确实设法从以下页面找到了解决方案:

    https://github.com/Homebrew/homebrew/issues/27515

    这显然是最新版本中的一个错误。做一个

    brew install python --with-brewed-openssl
    

    似乎可以解决问题。

    汤姆

    【讨论】:

    • brew uninstall python 之后为我工作。谢谢!
    • 在 10.13 上仍然可以工作,让 Azure CLI 正常工作——感谢您的提示!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-08-11
    • 1970-01-01
    • 1970-01-01
    • 2019-08-05
    • 1970-01-01
    • 2011-12-14
    相关资源
    最近更新 更多