python - python setup.py egg_info mysqlclient

标签 python macos python-3.x mysql-python macos-sierra

尝试在Python 3.6.0上使用pip3安装mysqlclient

$ pip3 install mysqlclient
Collecting mysqlclient
  Using cached mysqlclient-1.3.10.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/3k/08g3yx_12kg99kyfs989md600000gn/T/pip-build-1qv_89jc/mysqlclient/setup.py", line 17, in <module>
        metadata, options = get_config()
      File "/private/var/folders/3k/08g3yx_12kg99kyfs989md600000gn/T/pip-build-1qv_89jc/mysqlclient/setup_posix.py", line 54, in get_config
        libraries = [dequote(i[2:]) for i in libs if i.startswith('-l')]
      File "/private/var/folders/3k/08g3yx_12kg99kyfs989md600000gn/T/pip-build-1qv_89jc/mysqlclient/setup_posix.py", line 54, in <listcomp>
        libraries = [dequote(i[2:]) for i in libs if i.startswith('-l')]
      File "/private/var/folders/3k/08g3yx_12kg99kyfs989md600000gn/T/pip-build-1qv_89jc/mysqlclient/setup_posix.py", line 12, in dequote
        if s[0] in "\"'" and s[0] == s[-1]:
    IndexError: string index out of range

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/3k/08g3yx_12kg99kyfs989md600000gn/T/pip-build-1qv_89jc/mysqlclient/

已经做了
brew install mysql-connector-c

但是仍然出现此错误

最佳答案

这为我工作:

  • brew install mysql-connector-c
  • 编辑mysql_config(找到它:which mysql_config)

  • 在mysql_config中更正此错误:
    # Create options 
    libs="-L$pkglibdir"
    libs="$libs -l "
    

    应该是:
    # Create options 
    libs="-L$pkglibdir"
    libs="$libs -lmysqlclient -lssl -lcrypto"
    
  • brew info openssl
  • ,最后是pip3 install mysqlclient
  • 关于python - python setup.py egg_info mysqlclient,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43740481/

    相关文章:

    python - Pandas 中的数据透视表/反转表(但不完全是)

    Python 日志记录 : disable output to stdout

    python - pip 没有将 entry_points 安装为可执行文件

    python - 用于监视服务器运行状况的脚本库?

    ios - 以编程方式在 Xcode 中获取设备纵横比

    swift - 在NsView中,如何判断用户是否按住Shift键

    macos - "ResolvePackageAssets"任务意外失败

    r - 将 R 对象导入 Python 的最佳方法?

    python-3.x - 无法使用 `datetime` 从 Python `datetime64` 对象的可迭代对象转换为 Numpy `fromiter()` 对象的数组。漏洞?

    python - 如何以编程方式从 Python 提升到 Visual Studio 的顶部