致命错误:在安装Python MySQL的Mac Mojave上找不到'my_config.h'文件

时间:2018-11-30 07:34:14

标签: python mysql database macos

我有一个依赖于 MySQL-python == 1.2.5 的项目 我已经签出了thisthisthis之类的答案。但是,所有这些答案中提到的所有步骤均无济于事。 因此,该项目是一个Django应用程序,如上所述,它依赖于MySQL-python。该项目位于Python 2.7中,无法升级到Python3.X。 当我跑步时,

     pip install MySQL-python

我得到以下错误:

  Collecting MySQL-python
  Using cached https://files.pythonhosted.org/packages/a5/e9/51b544da85a36a68debe7a7091f068d802fc515a3a202652828c73453cad/MySQL-python-1.2.5.zip
  Building wheels for collected packages: MySQL-python
  Running setup.py bdist_wheel for MySQL-python ... error
  Complete output from command /Users/user.m2/.virtualenvs/del/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/f3/t5bk652s70g8f7x3q6_q290drg8nf8/T/pip-install-YiTuKO/MySQL-python/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /private/var/folders/f3/t5bk652s70g8f7x3q6_q290drg8nf8/T/pip-wheel-e63D7H --python-tag cp27:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.14-intel-2.7
  copying _mysql_exceptions.py -> build/lib.macosx-10.14-intel-2.7
  creating build/lib.macosx-10.14-intel-2.7/MySQLdb
  copying MySQLdb/__init__.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb
  copying MySQLdb/converters.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb
  copying MySQLdb/connections.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb
  copying MySQLdb/cursors.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb
  copying MySQLdb/release.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb
  copying MySQLdb/times.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb
  creating build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
  copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
  copying MySQLdb/constants/CR.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
  copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
  copying MySQLdb/constants/ER.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
  copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
  copying MySQLdb/constants/REFRESH.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
  copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
  running build_ext
  building '_mysql' extension
  creating build/temp.macosx-10.14-intel-2.7
  cc -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/local/Cellar/mysql/8.0.12/include/mysql -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mysql.c -o build/temp.macosx-10.14-intel-2.7/_mysql.o
  _mysql.c:44:10: fatal error: 'my_config.h' file not found
  #include "my_config.h"
          ^~~~~~~~~~~~~
  1 error generated.
  error: command 'cc' failed with exit status 1

  ----------------------------------------
  Failed building wheel for MySQL-python
  Running setup.py clean for MySQL-python
Failed to build MySQL-python
Installing collected packages: MySQL-python
  Running setup.py install for MySQL-python ... error
    Complete output from command /Users/user.m2/.virtualenvs/del/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/f3/t5bk652s70g8f7x3q6_q290drg8nf8/T/pip-install-YiTuKO/MySQL-python/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/f3/t5bk652s70g8f7x3q6_q290drg8nf8/T/pip-record-gOGq_n/install-record.txt --single-version-externally-managed --compile --install-headers /Users/user.m2/.virtualenvs/del/include/site/python2.7/MySQL-python:
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.14-intel-2.7
    copying _mysql_exceptions.py -> build/lib.macosx-10.14-intel-2.7
    creating build/lib.macosx-10.14-intel-2.7/MySQLdb
    copying MySQLdb/__init__.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb
    copying MySQLdb/converters.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb
    copying MySQLdb/connections.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb
    copying MySQLdb/cursors.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb
    copying MySQLdb/release.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb
    copying MySQLdb/times.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb
    creating build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
    copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
    copying MySQLdb/constants/CR.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
    copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
    copying MySQLdb/constants/ER.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
    copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
    copying MySQLdb/constants/REFRESH.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
    copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
    running build_ext
    building '_mysql' extension
    creating build/temp.macosx-10.14-intel-2.7
    cc -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/local/Cellar/mysql/8.0.12/include/mysql -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mysql.c -o build/temp.macosx-10.14-intel-2.7/_mysql.o
    _mysql.c:44:10: fatal error: 'my_config.h' file not found
    #include "my_config.h"
            ^~~~~~~~~~~~~
    1 error generated.
    error: command 'cc' failed with exit status 1

    ----------------------------------------
Command "/Users/user.m2/.virtualenvs/del/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/f3/t5bk652s70g8f7x3q6_q290drg8nf8/T/pip-install-YiTuKO/MySQL-python/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/f3/t5bk652s70g8f7x3q6_q290drg8nf8/T/pip-record-gOGq_n/install-record.txt --single-version-externally-managed --compile --install-headers /Users/user.m2/.virtualenvs/del/include/site/python2.7/MySQL-python" failed with error code 1 in /private/var/folders/f3/t5bk652s70g8f7x3q6_q290drg8nf8/T/pip-install-YiTuKO/MySQL-python/

我尝试使用其他虚拟环境,在执行上述步骤之前尝试更新自制软件。我仍然无法安装它。 有什么办法可以使它工作?

0 个答案:

没有答案
相关问题