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

#39;pip install MySQL-python#39; fails with #39;IndexError#39;(“pip install MySQL-python失败并显示“IndexError)
本文介绍了“pip install MySQL-python"失败并显示“IndexError"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 OSX El Capitan 上,使用 Python 2.7 (Anaconda).启动命令 pip install MySQL-python 产生:

I'm on OSX El Capitan, using Python 2.7 (Anaconda). Launching the command pip install MySQL-python yields:

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

这些都不起作用(退出时出现同样的错误).

None of these worked (exit with same error).

  • pip install mysqlclient
  • easy_install MySQL-python

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

pip is up-to-date. I've basically tried to follow all suggestions in related questions, but none succeeded. Any help is appreciated, thanks!

推荐答案

Copy from 此博客.

通过查找mysql-connector-c的信息,可以得出brew安装配置可能不正确的结论,打开/usr/local/bin/mysql_config 脚本来修改它的一些内容:

By finding out the information that mysql-connector-cmight come to the conclusion that the configuration by brew installation may be incorrect , open the /usr/local/bin/mysql_config script to modify some of the contents of it:

#Create options
Libs = "-L$pkglibdir "
Libs = "$libs -l"

改为:

#Create options
Libs = "-L$pkglibdir"
Libs = "$libs -lmysqlclient -lssl -lcrypto"

保存
然后重新安装mysql-python:

Save
Then re-install mysql-python:

pip install mysql-python

这篇关于“pip install MySQL-python"失败并显示“IndexError"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Hibernate reactive No Vert.x context active in aws rds(AWS RDS中的休眠反应性非Vert.x上下文处于活动状态)
Bulk insert with mysql2 and NodeJs throws 500(使用mysql2和NodeJS的大容量插入抛出500)
Flask + PyMySQL giving error no attribute #39;settimeout#39;(FlASK+PyMySQL给出错误,没有属性#39;setTimeout#39;)
auto_increment column for a group of rows?(一组行的AUTO_INCREMENT列?)
Sort by ID DESC(按ID代码排序)
SQL/MySQL: split a quantity value into multiple rows by date(SQL/MySQL:按日期将数量值拆分为多行)