【发布时间】:2012-01-14 01:49:55
【问题描述】:
我正在尝试使用 Python 2.7 安装 MySQLdb。我得到的错误如下所示:
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Dversion_info=(1,2,3,'final',0) -D__version__=1.2.3 -I/usr/include/mysql -I/opt/python2.7/include/python2.7 -c _mysql.c -o build/temp.linux-x86_64-2.7/_mysql.o -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64
gcc -pthread -shared build/temp.linux-x86_64-2.7/_mysql.o -L/usr/lib64/mysql -L. -lmysqlclient_r -lz -lpthread -lcrypt -lnsl -lm -lpthread -lmygcc -lpython2.7 -o build/lib.linux-x86_64-2.7/_mysql.so
/usr/bin/ld: cannot find -lpython2.7
collect2: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
显然,它找不到 Python 2.7。看着/usr/bin我看到了:
python*
python2@
python2.4*
python2.7@
@ 符号是什么意思?任何人都可以提出解决该错误的方法吗?
【问题讨论】:
-
你可能需要
python-dev包(与@无关) -
不要认为你想要 Python 二进制文件。看起来您需要 Python .o 文件,因为这是链接。
-
这个问题不应该是服务器故障吗?
标签: python linux mysql-python