error: command 'gcc' failed with exit status 1

注意,本文的方法只适用于MySQL-python包出现的情况!

解决办法:必须要把MySQL-python的安装包放在/usr/local/src下。

问题描述:我把它随手传到/home下了,结果爆出了这么个错误。

附注:对于其他出现“error: command 'gcc' failed with exit status 1”的情况,不一定适用。改天我整理一下吧。

[[email protected]]# python setup.py install
running install
running bdist_egg
running egg_info
writing MySQL_python.egg-info/PKG-INFO
writing top-level names to MySQL_python.egg-info/top_level.txt
writing dependency_links to MySQL_python.egg-info/dependency_links.txt
reading manifest file 'MySQL_python.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'MANIFEST'
warning: no files found matching 'ChangeLog'
warning: no files found matching 'GPL'
writing manifest file 'MySQL_python.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
copying MySQLdb/release.py -> build/lib.linux-x86_64-2.6/MySQLdb
running build_ext
building '_mysql' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Dversion_info=(1,2,3,'final',0) -D__version__=1.2.3 -I/usr/local/mysql/include -I/usr/local/include/python2.6 -c _mysql.c -o build/temp.linux-x86_64-2.6/_mysql.o -g
In file included from _mysql.c:36:
/usr/local/mysql/include/my_config.h:1057:1: warning: "SIZEOF_LONG" redefined
In file included from /usr/local/include/python2.6/Python.h:8,
                 from pymemcompat.h:10,
                 from _mysql.c:29:
/usr/local/include/python2.6/pyconfig.h:898:1: warning: this is the location of the previous definition
gcc -pthread -shared build/temp.linux-x86_64-2.6/_mysql.o -L/usr/local/mysql/lib -lmysqlclient_r -lz -lpthread -lcrypt -lnsl -lm -lpthread -lmygcc -o build/lib.linux-x86_64-2.6/_mysql.so
/usr/bin/ld: skipping incompatible /usr/local/mysql/lib/libmysqlclient_r.so when searching for -lmysqlclient_r
/usr/bin/ld: skipping incompatible /usr/local/mysql/lib/libmysqlclient_r.a when searching for -lmysqlclient_r
/usr/bin/ld: cannot find -lmysqlclient_r
collect2: ld returned 1 exit status
error: command 'gcc' failed with exit status 1

你可能感兴趣的:(mysql,command,File,gcc,Build)