本文介绍了在macOS Sierra上安装pip的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我一直试图通过brew在macOS sierra上安装pip,但是每次完成时都没有在/usr/local/Cellar/python/2.7.13/bin
中安装二进制文件.
I've been trying to install pip on macOS sierra via brew, but every time it completes without installing the binaries in /usr/local/Cellar/python/2.7.13/bin
.
我尝试过:
MacBook-Pro ➜ brew reinstall python
然后:
MacBook-Pro ➜ ~ which pip
pip not found
我找到了python的路径,它是/usr/local/Cellar/python/2.7.13/bin
,但那里没有pip的二进制文件.
I found the path to python, which is /usr/local/Cellar/python/2.7.13/bin
but no binary for pip there.
我还尝试了easy_install
方法:
MacBook-Pro ➜ sudo easy_install pip
Traceback (most recent call last):
File "/usr/bin/easy_install-2.7", line 11, in <module>
load_entry_point('setuptools==18.5', 'console_scripts', 'easy_install')()
File "/Library/Python/2.7/site-packages/pkg_resources.py", line 352, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/Library/Python/2.7/site-packages/pkg_resources.py", line 2307, in load_entry_point
return ep.load()
File "/Library/Python/2.7/site-packages/pkg_resources.py", line 2021, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/__init__.py", line 12, in <module>
from setuptools.extension import Extension
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/extension.py", line 8, in <module>
from .dist import _get_unpatched
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/dist.py", line 21, in <module>
packaging = pkg_resources.packaging
AttributeError: 'module' object has no attribute 'packaging'
更新:
当我运行brew postinstall python
时,出现以下错误:
When I run brew postinstall python
I am getting the following error:
MacBook-Pro ➜ ~ brew postinstall python
==> Using the sandbox
==> /usr/local/Cellar/python/2.7.13/bin/python -s setup.py --no-user-cfg install --force --verbose --single-version-externally-managed --rec
==> /usr/local/Cellar/python/2.7.13/bin/python -s setup.py --no-user-cfg install --force --verbose --single-version-externally-managed --rec
Last 15 lines from /Users/justin/Library/Logs/Homebrew/python/post_install.02.python:
Traceback (most recent call last):
File "setup.py", line 92, in <module>
cmdclass={'test': PyTest},
File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 111, in setup
_setup_distribution = dist = klass(attrs)
File "/Users/justin/.venvburrito/lib/python/distribute-0.6.35-py2.7.egg/setuptools/dist.py", line 225, in __init__
_Distribution.__init__(self,attrs)
File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 287, in __init__
self.finalize_options()
File "/Users/justin/.venvburrito/lib/python/distribute-0.6.35-py2.7.egg/setuptools/dist.py", line 258, in finalize_options
ep.load()(self, ep.name, value)
File "/Users/justin/.venvburrito/lib/python/distribute-0.6.35-py2.7.egg/pkg_resources.py", line 2020, in load
raise ImportError("%r has no %r attribute" % (entry,attr))
ImportError: <module 'setuptools.dist' from '/Users/justin/.venvburrito/lib/python/distribute-0.6.35-py2.7.egg/setuptools/dist.pyc'> has no 'check_specifier' attribute
推荐答案
您只需要安装pip
,它不会自动安装在macOS Sierra中.
You just need to install pip
which is not automatically installed in macOS Sierra.
运行sudo easy_install pip
这篇关于在macOS Sierra上安装pip的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!