簡體   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