【问题标题】:Python: How to resolve python setup.py egg_info failed with error code 1Python:如何解决 python setup.py egg_info failed with error code 1
【发布时间】:2018-01-28 01:40:58
【问题描述】:

我看到了与我的类似问题的答案,但没有一个答案对我有帮助。 我仍然有同样的问题。如果重复,我很抱歉,但其他答案对我没有帮助。

我被 Django 中的一个项目困住了,我必须在其中安装 MySQL-python。 当我运行pip install MySQL-Python 时出现此错误:

Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-build-Ue6URf/MySQL-Python/

我按照这里的一些答案中的建议使用了 brew,但根本没有帮助。 我正在使用带有最后一个 Python3 和最后一个 Django 版本的 Mac 机器。 我有 MampPro 最后一个版本,我正在使用 MySQL 服务。

我正在分享安装的整个输出:

    Collecting MySQL-Python
  Downloading MySQL-python-1.2.5.zip (108kB)
    100% |################################| 112kB 561kB/s 
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/tmp/pip-build-Ue6URf/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/tmp/pip-build-Ue6URf/MySQL-Python/

【问题讨论】:

  • 我看到了这个问题,但这并不能解决我的问题我仍然有同样的问题

标签: python mysql django


【解决方案1】:

我解决了我的问题,感谢 StackOverflow 中的这篇文章 answer for PIP install fail

我不得不修改我的 mysql_config 文件并在这个答案中描述导出部分。 之后,我能够再次安装 pip install ...

【讨论】:

    【解决方案2】:

    请按照以下说明进行操作

    1. sudo apt install libmysqlclient-dev
    2. pip install MySql-python

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-05-29
      相关资源
      最近更新 更多