macos - Mac 上的 Pip 安装失败

标签 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 解决方案对我来说不起作用。

最佳答案

这个 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"

关于macos - Mac 上的 Pip 安装失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48348773/

相关文章:

python - 为什么会出现 "List index out of range"错误?

python - 为什么导入并不总是导入嵌套包?

C++ 行在循环外重复 8 次

python - 找到最大的非重叠区间

macos - 指定的服务器位置(Catalina 主页)文件夹无效。带有 Netbeans 8.1 的 Tomcat 9

ruby - 无法在 Mac OSX 10.8.3 上运行 ruby

Python:从字典中删除大量键的最快策略

python - 将额外的值连同 url 一起传递给 scrapy spider

python - Pandas 很顽固地安装

macos - : "Search tree file' s format version number (0) is not supported"?是什么意思