【问题标题】:Error while installing mysqlclient on MacOS Sierra (Python 3.6)在 MacOS Sierra (Python 3.6) 上安装 mysqlclient 时出错
【发布时间】:2023-03-30 04:54:01
【问题描述】:

我正在尝试为我的 MacOS Sierra (Python3) 安装 mysqlclient。

好吧,我尝试按照官方页面https://github.com/PyMySQL/mysqlclient-python 上的说明进行操作。

所以,一切都很好,直到:

pip install 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/q4/j199zrpj015c7dyj7qfl22qm0000gn/T/pip-build-9v6DOo/mysqlclient/setup.py", line 17, in <module>
    metadata, options = get_config()
      File "setup_posix.py", line 54, in get_config libraries = [dequote(i[2:]) for i in libs if i.startswith('-l')]
      File "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/q4/j199zrpj015c7dyj7qfl22qm0000gn/T/pip-build-9v6DOo/mysqlclient/

如果有人有一些想法来解决它,请帮助我。 (库是用 brew 下载的)。 我怀疑我的 Mac 上同时安装了 Python 2.7 和 Python 3.6。但是,其实我不知道 :)

编辑:花了几个小时搜索,仍然找不到答案

【问题讨论】:

    标签: python mysql pip python-3.6


    【解决方案1】:

    https://stackoverflow.com/a/43645248/7136153 这对我有帮助。 我做以下事情:

    brew uninstall mysql-connector-c
    brew install mysql
    pip3 install mysqlclient
    

    【讨论】:

    • 感谢它解决了我 2 天以来一直在寻找的问题
    【解决方案2】:

    你的点子太旧了。先升级再试试。

    pip3 install -U pip
    sudo pip3 install mysqlclient
    

    【讨论】:

    • 我试过这个,它只对成功获取包起作用。但是对于安装它给了我错误
    猜你喜欢
    • 2020-06-10
    • 1970-01-01
    • 2017-06-30
    • 2017-06-14
    • 1970-01-01
    • 1970-01-01
    • 2019-03-01
    • 1970-01-01
    • 2017-09-22
    相关资源
    最近更新 更多