我在上,使用Python2.7 (Anaconda)。启动命令pip install MySQL-python生成:
Collecting MySQL-python
Using cached MySQL-python-1.2.5.zip
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/d2/gd004m2s35z5dlyz9mfn6sc40000gn/T/pip-build-FYvb_T/MySQL-python/setup.py", line 17, in <module>
metadata, options = get_config()
File "setup_posix.py", line 53, in get_config
libraries = [ dequote(i[2:]) for i in libs if i.startswith(compiler_flag("l")) ]
File "setup_posix.py", line 8, in dequote
if s[0] in "\"'" and s[0] == s[-1]:
IndexError: string index out of range这些操作都不起作用(退出时有相同的错误)。
pip install mysqlclienteasy_install MySQL-pythonpip是最新的.我基本上试着遵循所有相关问题的建议,但都没有成功。任何帮助都是感激的,谢谢!
发布于 2017-06-01 13:50:19
从这个博客。复制
通过查找mysql-connector-c可能得出的结论,即brew安装的配置可能是不正确的,打开/usr/local/bin/mysql_config脚本来修改其中的一些内容:
#Create options
Libs = "-L$pkglibdir "
Libs = "$libs -l"改为:
#Create options
Libs = "-L$pkglibdir"
Libs = "$libs -lmysqlclient -lssl -lcrypto"保存
然后重新安装mysql-python:
pip install mysql-python发布于 2017-11-07 17:11:29
我遇到了同样的错误,并通过以下说明解决了问题:
发布于 2018-10-03 10:54:09
这解决了我的问题:
brew install mysql@5.7
brew link --force mysql@5.7https://stackoverflow.com/questions/43543483
复制相似问题