weixin_41914349 2020-06-01 08:58 采纳率: 0%
浏览 199

macOS系统下安装MySQL-Python一直报错怎么解决?

试了网上的各种方法还是不能正常安装。
报错代码如下:
ERROR: Command errored out with exit status 1:
command: /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/tmp/pip-install-lxfX8c/MySQL-Python/setup.py'"'"'; file='"'"'/private/tmp/pip-install-lxfX8c/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/tmp/pip-wheel-6O8ZVJ
cwd: /private/tmp/pip-install-lxfX8c/MySQL-Python/
Complete output (30 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.15-x86_64-2.7
copying mysql_exceptions.py -> build/lib.macosx-10.15-x86_64-2.7
creating build/lib.macosx-10.15-x86_64-2.7/MySQLdb
copying MySQLdb/
_init__.py -> build/lib.macosx-10.15-x86_64-2.7/MySQLdb
copying MySQLdb/converters.py -> build/lib.macosx-10.15-x86_64-2.7/MySQLdb
copying MySQLdb/connections.py -> build/lib.macosx-10.15-x86_64-2.7/MySQLdb
copying MySQLdb/cursors.py -> build/lib.macosx-10.15-x86_64-2.7/MySQLdb
copying MySQLdb/release.py -> build/lib.macosx-10.15-x86_64-2.7/MySQLdb
copying MySQLdb/times.py -> build/lib.macosx-10.15-x86_64-2.7/MySQLdb
creating build/lib.macosx-10.15-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.15-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.macosx-10.15-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.15-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.macosx-10.15-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.15-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.macosx-10.15-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.15-x86_64-2.7/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.macosx-10.15-x86_64-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 -iwithsysroot /usr/local/libressl/include -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -pipe -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/local/Cellar/mysql/8.0.19_1/include/mysql -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mysql.c -o build/temp.macosx-10.15-x86_64-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


ERROR: 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
ERROR: Command errored out with exit status 1:
command: /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/tmp/pip-install-lxfX8c/MySQL-Python/setup.py'"'"'; file='"'"'/private/tmp/pip-install-lxfX8c/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-c9UgRs/install-record.txt --single-version-externally-managed --compile --install-headers /System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/MySQL-Python
cwd: /private/tmp/pip-install-lxfX8c/MySQL-Python/
Complete output (30 lines):
running install
running build
running build_py
creating build
creating build/lib.macosx-10.15-x86_64-2.7
copying mysql_exceptions.py -> build/lib.macosx-10.15-x86_64-2.7
creating build/lib.macosx-10.15-x86_64-2.7/MySQLdb
copying MySQLdb/
_init__.py -> build/lib.macosx-10.15-x86_64-2.7/MySQLdb
copying MySQLdb/converters.py -> build/lib.macosx-10.15-x86_64-2.7/MySQLdb
copying MySQLdb/connections.py -> build/lib.macosx-10.15-x86_64-2.7/MySQLdb
copying MySQLdb/cursors.py -> build/lib.macosx-10.15-x86_64-2.7/MySQLdb
copying MySQLdb/release.py -> build/lib.macosx-10.15-x86_64-2.7/MySQLdb
copying MySQLdb/times.py -> build/lib.macosx-10.15-x86_64-2.7/MySQLdb
creating build/lib.macosx-10.15-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.15-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.macosx-10.15-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.15-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.macosx-10.15-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.15-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.macosx-10.15-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.15-x86_64-2.7/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.macosx-10.15-x86_64-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 -iwithsysroot /usr/local/libressl/include -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -pipe -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/local/Cellar/mysql/8.0.19_1/include/mysql -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c mysql.c -o build/temp.macosx-10.15-x86_64-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
----------------------------------------
ERROR: Command errored out with exit status 1: /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/tmp/pip-install-lxfX8c/MySQL-Python/setup.py'"'"'; __file
_='"'"'/private/tmp/pip-install-lxfX8c/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-c9UgRs/install-record.txt --single-version-externally-managed --compile --install-headers /System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/MySQL-Python Check the logs for full command output.

有没有大佬教一教该怎么解决这个问题。

  • 写回答

1条回答 默认 最新

  • 关注
    评论

报告相同问题?

悬赏问题

  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?
  • ¥15 matlab(相关搜索:紧聚焦)
  • ¥15 基于51单片机的厨房煤气泄露检测报警系统设计
  • ¥15 路易威登官网 里边的参数逆向
  • ¥15 Arduino无法同时连接多个hx711模块,如何解决?
  • ¥50 需求一个up主付费课程