简体   繁体   English

错误:安装脚本退出并显示错误:命令“ gcc”失败,退出状态为1

[英]error: Setup script exited with error: command 'gcc' failed with exit status 1

I get the following error when I try to install MySQL-python-1.2.3 under Python 2.6 in Fedora 14. 当我尝试在Fedora 14中的Python 2.6下安装MySQL-python-1.2.3时出现以下错误。

Fedora 14 comes with Python 2.7 by default and I am working in a project which runs in Python 2.6, So I am not in a position to update Python from 2.6 to 2.7. Fedora 14默认情况下带有Python 2.7,我正在一个以Python 2.6运行的项目中工作,因此我无法将Python从2.6更新到2.7。

_mysql.c:35:23: fatal error: my_config.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1

The complete error message is as below 完整的错误信息如下

[root@localhost MySQL-python-1.2.2]# python setup.py build
running build
running build_py
creating build
creating build/lib.linux-i686-2.6
copying _mysql_exceptions.py -> build/lib.linux-i686-2.6
creating build/lib.linux-i686-2.6/MySQLdb
copying MySQLdb/__init__.py -> build/lib.linux-i686-2.6/MySQLdb
copying MySQLdb/converters.py -> build/lib.linux-i686-2.6/MySQLdb
copying MySQLdb/connections.py -> build/lib.linux-i686-2.6/MySQLdb
copying MySQLdb/cursors.py -> build/lib.linux-i686-2.6/MySQLdb
copying MySQLdb/release.py -> build/lib.linux-i686-2.6/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-i686-2.6/MySQLdb
creating build/lib.linux-i686-2.6/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.linux-i686-2.6/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.linux-i686-2.6/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-i686-2.6/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.linux-i686-2.6/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.linux-i686-2.6/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.linux-i686-2.6/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.linux-i686-2.6/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.linux-i686-2.6
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Dversion_info=(1,2,2,'final',0) -D__version__=1.2.2 -I/usr/include/mysql -I/usr/local/include/python2.6 -c _mysql.c -o build/temp.linux-i686-2.6/_mysql.o -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -fasynchronous-unwind-tables -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing -fwrapv -fPIC -DUNIV_LINUX
_mysql.c:35:23: fatal error: my_config.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
[root@localhost MySQL-python-1.2.2]# python2.6 setup.py build
running build
running build_py
copying MySQLdb/release.py -> build/lib.linux-i686-2.6/MySQLdb
running build_ext
building '_mysql' extension
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Dversion_info=(1,2,2,'final',0) -D__version__=1.2.2 -I/usr/include/mysql -I/usr/local/include/python2.6 -c _mysql.c -o build/temp.linux-i686-2.6/_mysql.o -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -fasynchronous-unwind-tables -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing -fwrapv -fPIC -DUNIV_LINUX
_mysql.c:35:23: fatal error: my_config.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1

您需要安装MySQL开发包

yum install mysql-devel

Install python-devel. 安装python-devel。 That should help 那应该有帮助

Solved this issue in the following way 通过以下方式解决了此问题

  1. Copy MySQLdb folder from site-packages directory of Python2.7 to Python2.6. MySQLdb文件夹从Python2.7的site-packages目录复制到Python2.6。
  2. Also copy the following files from site-packages directory of Python2.7 to Python2.6. 还将以下文件从Python2.7的site-packages目录复制到Python2.6。

    _mysql.so

    _mysql_exceptions.py

    _mysql_exceptions.pyc

    _mysql_exceptions.pyo

Now try the following 现在尝试以下

>>> import MySQLdb  
>>> MySQLdb.__version__  
'1.2.3'

暂无
暂无

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

相关问题 安装matplotlib,错误:安装脚本退出并显示错误:命令'gcc'失败,退出状态为1 - installing matplotlib, error: Setup script exited with error: command 'gcc' failed with exit status 1 错误:安装脚本退出,并显示错误:命令'i586-linux-gnu-gcc'失败,退出状态为1 - error: Setup script exited with error: command 'i586-linux-gnu-gcc' failed with exit status 1 python install zbar 错误:安装脚本退出并出现错误:命令“gcc”失败,退出状态为 1 - python install zbar error: Setup script exited with error: command 'gcc' failed with exit status 1 easy_install pyzmq,cygwin。 错误:安装脚本退出并显示错误:命令“ gcc”失败,退出状态为1 - easy_install pyzmq, cygwin. error: Setup script exited with error: command 'gcc' failed with exit status 1 安装脚本退出并出现错误:命令“x86_64-linux-gnu-gcc”失败,退出状态为 1 - setup script exited with error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 Kerberos 安装错误,错误:安装脚本退出并出现错误:命令“i686-linux-gnu-gcc”失败,退出状态为 1 - Kerberos installation error, error: Setup script exited with error: command 'i686-linux-gnu-gcc' failed with exit status 1 安装Pillow错误:安装脚本退出并显示错误:命令'x86_64-linux-gnu-gcc'失败,退出状态为1 - Installing Pillow error: Setup script exited with error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 当我easy_install greenlet我得到“错误:安装脚本退出时出现错误:命令'gcc'失败,退出状态为1” - when i easy_install greenlet i got “error: Setup script exited with error: command 'gcc' failed with exit status 1 ” PyXML Ubuntu 13.1,错误:安装脚本退出,错误:命令“ x86_64-linux-gnu-gcc”失败,退出状态为1 - PyXML Ubuntu 13.1, error: Setup script exited with error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 运行easy_install PIL时,出现错误:安装脚本退出错误:命令'cc'失败,退出状态为1 - when running easy_install PIL, I got the error: Setup script exited with error: command 'cc' failed with exit status 1
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM