繁体   English   中英

错误:命令“cc”在 Mac 上失败,退出状态为 1,用于 pip install MySQL-python

[英]error: command 'cc' failed with exit status 1 on Mac for pip install MySQL-python

由于此导入错误,我需要在 Mac 上通过 (pip install MySQL-python) 安装 MySQL-python:

导入错误:没有名为 MySQLdb 的模块

但是pip install MySQL-python的时候出现这个错误:

running build_ext
building '_mysql' extension
creating build/temp.macosx-10.14-intel-2.7
cc -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes 
-Qunused-arguments -Qunused-arguments -arch i386 
-arch x86_64 -pipe -Dversion_info=(1,2,5,'final',1) 
-D__version__=1.2.5 -I/usr/local/opt/mysql-client/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

我尝试了 Stackoverflow 提供的不同解决方案,例如: “'cc' failed with exit status 1” error when install python library or command 'cc' failed with exit status 1 on OSX High Sierra但仍然得到相同的错误。 有什么建议或意见可以解决这个问题吗?

更多信息:

 (virt-env) m-c0:fz$ which python
   /usr/bin/python
 (virt-env) m-c0:fz$ which pip
  /usr/local/bin/pip
 (virt-env) m-c0:fz$ python --version
  Python 2.7.16

  export PATH="/usr/local/opt/cython/bin:$PATH"
  export PATH="/Users/zf/Library/Python/2.7/bin:$PATH"
  export PATH=$PATH:/usr/local/Cellar/mysql/8.0.18_1/bin
  export PATH="/usr/local/opt/mysql-client/bin:$PATH"
  export CFLAGS=-Qunused-arguments
  export CPPFLAGS=-Qunused-arguments

您的 Mac OS 上没有安装 mysql C 库,有多种安装选项。

您可以轻松安装它,因为您在 Mac OS 上安装了brew ,或者谷歌搜索其他选项以使用您的 env 安装库。

更多信息

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM