Pip安装在Mac上失败

时间:2018-01-19 20:09:53

标签: macos python-2.7

" 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 "/Users/swastika.singhal/Library/Python/2.7/lib/python/site-packages/pkg_resources/__init__.py", line 572, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/Users/swastika.singhal/Library/Python/2.7/lib/python/site-packages/pkg_resources/__init__.py", line 2755, in load_entry_point
    return ep.load()
  File "/Users/swastika.singhal/Library/Python/2.7/lib/python/site-packages/pkg_resources/__init__.py", line 2408, in load
    return self.resolve()
  File "/Users/swastika.singhal/Library/Python/2.7/lib/python/site-packages/pkg_resources/__init__.py", line 2414, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/command/easy_install.py", line 46, in <module>
    from setuptools.archive_util import unpack_archive
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/archive_util.py", line 15, in <module>
    from pkg_resources import ensure_directory, ContextualZipFile
ImportError: cannot import name ContextualZipFile

到目前为止,Google解决方案对我无效。

1 个答案:

答案 0 :(得分:0)

这个GitHub问题帮助我解决了这个问题:github.com/PyMySQL/mysqlclient-python/issues/169

具体做法是:

mysql_config中有一些行如下:

# Create options 
libs="-L$pkglibdir"
libs="$libs -l "

我将它们编辑为:

# Create options 
libs="-L$pkglibdir"
libs="$libs -lmysqlclient -lssl -lcrypto"