/usr/bin/ld:找不到-lpython2.7 [英] /usr/bin/ld: cannot find -lpython2.7
问题描述
我正在尝试使用Python 2.7安装MySQLdb.我收到的错误看起来像这样:
I'm trying to install MySQLdb with Python 2.7. The error I'm getting looks like this:
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
,我看到了:
Clearly, it can't find Python 2.7. Looking in /usr/bin
I see:
python*
python2@
python2.4*
python2.7@
@
符号是什么意思?谁能建议对此错误采取补救措施?
What does the @
symbol mean? Can anyone advise a remedy to the error?
推荐答案
它找不到Python库,而不是可执行文件.运行locate libpython2.7.a
以查看Python库的位置,并将其添加到库路径(例如,如果它位于/opt/python2.7/lib
中,则您要调用LDFLAGS="-L/opt/python2.7/lib" make
).
It can't find the Python library, not the executable. Run locate libpython2.7.a
to see where your Python library is located, and add it to the library path (e.g. if it is in /opt/python2.7/lib
, you want to call LDFLAGS="-L/opt/python2.7/lib" make
).
@
符号表示文件是符号链接; *
表示它是可执行文件(这些文件由 ls -F
产生,您可能会使用它作为别名).
The @
symbol means the file is a symbolic link; *
means it's executable (these are produced by ls -F
, which you might have as an alias).
这篇关于/usr/bin/ld:找不到-lpython2.7的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!