MacOS |蟒蛇2.7
我想用MySQLdb。当我跑的时候

pip install MySQL-python

结果是
JourneydeMacBook-Pro:~ JourneyWoo$ 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/g9/y4rms8zx6yvjjn1m1w6w0000gn/T/pip-build-JFpAwP/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

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/g9/y4rms8zx6yvjjn1m1w6w0000gn/T/pip-build-JFpAwP/MySQL-python/

我想我的点子有问题,所以我跑
pip install --upgrade setuptools
pip install ez_setup
pip install unroll

它们都很好用,但当我再试一次时
pip install MySQL-python

它仍然有问题。
我没有得到答案,可以解决我的问题,从谷歌搜索,真的谢谢你,如果你能帮助我这一点。

最佳答案

sudo apt get install python dev默认libmysqlclient dev#Debian/Ubuntu
运行这个解决了我的问题

关于python - pip安装MySQL-python,命令“python setup.py egg_info”失败,错误代码为1,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/44343133/

10-15 23:31