gpt4 book ai didi

python - “pip install MySQL-python”失败并显示 'IndexError'

转载 作者:行者123 更新时间:2023-11-29 16:01:20 26 4
gpt4 key购买 nike

我使用的是 OSX El Capitan,使用的是 Python 2.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 mysqlclient
  • easy_install MySQL-python

pip 是最新的。我基本上尝试遵循相关问题中的所有建议,但没有成功。感谢任何帮助,谢谢!

最佳答案

复制自this blog.

通过查找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

关于python - “pip install MySQL-python”失败并显示 'IndexError',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56182424/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com