Python:如何解决 python setup.py egg_info failed with error code 1

标签 python mysql django

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

我被 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/

最佳答案

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

我必须修改我的 mysql_config 文件并执行此答案中描述的导出部分。 之后,我可以通过 pip install 再次安装 ...

关于Python:如何解决 python setup.py egg_info failed with error code 1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45772402/

相关文章:

python - 为什么我在使用 IMDbPY 时会收到这么多警告和一些错误?

Python将 "met conditional value"移到循环之外

php - 如何在类之外显示来自数据库的数据

Mysql 查询 inverse IN 或从数组中搜索一个项目

Python - 增加字典值的函数

python - Sqlite 插入不适用于 python

mysql - 如何使用 Dockerfile 更改 MySQL 上的默认 IP

python - “选项”对象没有属性 'get_all_field_names'

django - 在 pydev 中启动应用程序

django - 如何重写此 postgres 约束以更符合 django 2.2?