在MacOS Sierra(Python 3.6)上安装mysqlclient时出错。
在MacOS Sierra(Python 3.6)上安装mysqlclient时出错。
我试图在我的MacOS Sierra(Python3)上安装mysqlclient。\n嗯,我试图按照官方页面上的说明进行:https://github.com/PyMySQL/mysqlclient-python。\n所以,一切都很顺利,直到:\n
pip install mysqlclient pip3 install mysqlclient
\n它给我抛出了以下错误:\n
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 "", line 1, in File "/private/var/folders/q4/j199zrpj015c7dyj7qfl22qm0000gn/T/pip-build-9v6DOo/mysqlclient/setup.py", line 17, in 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/
\n如果有人有解决办法,请帮帮我。(库已使用brew下载)。\n我怀疑我在我的Mac上同时安装了Python 2.7和Python 3.6。但实际上我不确定 :)\n编辑:搜索了几个小时,还是找不到答案。
在MacOS Sierra(Python 3.6)上安装mysqlclient时出现错误。根据https://stackoverflow.com/a/43645248/7136153的解答,我按照以下步骤进行操作:
brew uninstall mysql-connector-c brew install mysql pip3 install mysqlclient
感谢这个解决方案,它解决了我在过去两天一直遇到的问题。