代码之家  ›  专栏  ›  技术社区  ›  Filipe Ferminiano

命令“cc”失败,OSX High Sierra上的退出状态为1

  •  4
  • Filipe Ferminiano  · 技术社区  · 6 年前

    我想在Mac OS High Sierra上跑步

    pip install MySQL-python
    

    但我正在

    error: command 'cc' failed with exit status 1
    

    我已经试过了 this topic 但是没有用。

    这是完整的错误信息

    The directory '/Users/filipeferminiano/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
    The directory '/Users/filipeferminiano/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
    Collecting MySQL-python
      Downloading https://files.pythonhosted.org/packages/a5/e9/51b544da85a36a68debe7a7091f068d802fc515a3a202652828c73453cad/MySQL-python-1.2.5.zip (108kB)
        100% |████████████████████████████████| 112kB 289kB/s 
    Installing collected packages: MySQL-python
      Running setup.py install for MySQL-python ... error
        Complete output from command /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-install-8I1X5u/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/tmp/pip-record-z5HohX/install-record.txt --single-version-externally-managed --compile:
        running install
        running build
        running build_py
        creating build
        creating build/lib.macosx-10.13-intel-2.7
        copying _mysql_exceptions.py -> build/lib.macosx-10.13-intel-2.7
        creating build/lib.macosx-10.13-intel-2.7/MySQLdb
        copying MySQLdb/__init__.py -> build/lib.macosx-10.13-intel-2.7/MySQLdb
        copying MySQLdb/converters.py -> build/lib.macosx-10.13-intel-2.7/MySQLdb
        copying MySQLdb/connections.py -> build/lib.macosx-10.13-intel-2.7/MySQLdb
        copying MySQLdb/cursors.py -> build/lib.macosx-10.13-intel-2.7/MySQLdb
        copying MySQLdb/release.py -> build/lib.macosx-10.13-intel-2.7/MySQLdb
        copying MySQLdb/times.py -> build/lib.macosx-10.13-intel-2.7/MySQLdb
        creating build/lib.macosx-10.13-intel-2.7/MySQLdb/constants
        copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.13-intel-2.7/MySQLdb/constants
        copying MySQLdb/constants/CR.py -> build/lib.macosx-10.13-intel-2.7/MySQLdb/constants
        copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.13-intel-2.7/MySQLdb/constants
        copying MySQLdb/constants/ER.py -> build/lib.macosx-10.13-intel-2.7/MySQLdb/constants
        copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.13-intel-2.7/MySQLdb/constants
        copying MySQLdb/constants/REFRESH.py -> build/lib.macosx-10.13-intel-2.7/MySQLdb/constants
        copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.13-intel-2.7/MySQLdb/constants
        running build_ext
        building '_mysql' extension
        creating build/temp.macosx-10.13-intel-2.7
        cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -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.11/include/mysql -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mysql.c -o build/temp.macosx-10.13-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 "/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-install-8I1X5u/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/tmp/pip-record-z5HohX/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/tmp/pip-install-8I1X5u/MySQL-python/
    

    这是蟒蛇

    which python
    /usr/bin/python
    

    这是我用的pip

    which pip
    /usr/local/bin/pip
    
    3 回复  |  直到 6 年前
        1
  •  0
  •   Optimus Prime    6 年前

    brew install mysql-connector-c
    brew install mysql
    brew link --overwrite mysql
    pip install MySQL-python
    
        2
  •  7
  •   abarnert    6 年前

    MySQL-python


    python-MySQLdb

    MySQLConnector/C libmysqlclient


    INSTALL MySQL downloads

    Downloads

    -macos10.13-x86_64.dmg

    Homebrew brew

    brew install mysql@5.5
    

    brew install openssl