当前位置: 首页 > 面试题库 >

命令'cc'在OSX High Sierra上失败,退出状态为1

赫连淳
2023-03-14
问题内容

我试图在Mac Os High Sierra上运行

pip install MySQL-python

但是我越来越

error: command 'cc' failed with exit status 1

我已经尝试过有关该主题的解决方案,但是没有用。

这是完整的错误信息

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

这是我正在使用的点

which pip
/usr/local/bin/pip

问题答案:

abamert的答案对我不起作用。虽然这样做,但您可以尝试跳过第一步,

brew install mysql-connector-c
brew install mysql
brew link --overwrite mysql
pip install MySQL-python


 类似资料:
  • 问题内容: 我试图安装“学者”软件包,但我不断收到此错误: 问题答案: 我有同样的问题。这帮助了我: 如果您使用python3,请尝试将其替换为

  • 问题内容: 我正在尝试使用CentOS安装lxml软件包,并在最后抛出此错误: 错误: 问题答案: 是否安装了gcc?

  • 问题内容: 我正在运行Ubuntu 11.04,Python 2.7.1,并想安装Pyaudio。所以我跑了 在终端中,并退出并显示以下错误消息, 我不确定是将其发布在askubuntu.com还是在stackoveflow中发布,但是无论如何,它都在stackoverflow中。另外我用谷歌搜索了一下这个问题,发现通过安装python- dev已经解决了一些问题。我已经安装了python-dev

  • 我想在我的系统上安装,以便为软件部署提供“herd”..但是终端显示一个gcc错误: 为什么找不到?

  • 问题内容: 像许多其他工具一样,我在安装python库时遇到问题(下载为tar,然后解压缩)。 如在其他地方建议的那样,我尝试输入终端“ ARCHFLAGS = -Wno-error = unused-command-line-argument- hard-error-in-future sudo python setup.py install”,但没有成功。 有没有办法解决似乎在xcode 5.

  • 问题内容: 我是shell脚本方面的菜鸟。如果命令失败,我想打印一条消息并退出脚本。我试过了: 但它不起作用。它会继续执行脚本中此行之后的指令。我正在使用Ubuntu和bash。 问题答案: 尝试: 四个变化: 更改为 使用代替 在和之后介绍 之前和之后的空格 既然你要打印的消息,只有当命令失败(非零值退出)退出你需要一个不是。 将在成功时运行(退出值)。在哪里 将在失败(退出值非零)时运行。 使