pip install pubnub throws“gcc”失败

2024-06-16 13:40:04 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试安装pubnub库,当我pip install pubnub时,我得到了一个错误

Compiling support for Intel AES instructions
building 'Crypto.Hash._MD2' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/src
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DLTC_NO_ASM -DHAVE_CPUID_H -Isrc/ -I/usr/include/python2.7 -c src/MD2.c -o build/temp.linux-x86_64-2.7/src/MD2.o
gcc -pthread -shared build/temp.linux-x86_64-2.7/src/MD2.o -L/usr/lib64 -lpython2.7 -o build/lib.linux-x86_64-2.7/Crypto/Hash/_MD2.so
/usr/bin/ld: cannot find -lpython2.7
collect2: error: ld returned 1 exit status
error: command 'gcc' failed with exit status 1

这些是我遵循的步骤

^{pr2}$

谢谢


Tags: buildcreatingsrcsourcelinuxusrhashcrypto
2条回答

您需要安装Python的头文件。如何做到这一点将取决于您的操作系统。在

例如,在Debian或Ubuntu上,类似

sudo apt-get install python-dev

应该这么做。在

戴着软呢帽/CentOS/红帽,试试看

^{pr2}$

解决这个问题,我必须遵循以下步骤

ld -lpython2.7  verbose

attempt to open /usr/x86_64-amazon-linux/lib64/libpython2.7.so failed
attempt to open /usr/x86_64-amazon-linux/lib64/libpython2.7.a failed
attempt to open /usr/local/lib64/libpython2.7.so failed
attempt to open /usr/local/lib64/libpython2.7.a failed
attempt to open /lib64/libpython2.7.so failed
attempt to open /lib64/libpython2.7.a failed
attempt to open /usr/lib64/libpython2.7.so failed
attempt to open /usr/lib64/libpython2.7.a failed
attempt to open /usr/x86_64-amazon-linux/lib/libpython2.7.so failed
attempt to open /usr/x86_64-amazon-linux/lib/libpython2.7.a failed
attempt to open /usr/lib64/libpython2.7.so failed
attempt to open /usr/lib64/libpython2.7.a failed
attempt to open /usr/local/lib/libpython2.7.so failed
attempt to open /usr/local/lib/libpython2.7.a failed
attempt to open /lib/libpython2.7.so failed
attempt to open /lib/libpython2.7.a failed
attempt to open /usr/lib/libpython2.7.so failed
attempt to open /usr/lib/libpython2.7.a failed

检查ldconfig softlink for python并找出它指向什么

^{pr2}$

这表明它在寻找一个错误的软链接,我就这样改变了软链接

sudo ln -s /usr/lib64/libpython2.7.so.1.0 /usr/lib64/libpython2.7.so

然后不得不像这样运行pip

sudo /usr/local/bin/pip install pubnub   Location of pip installed

效果不错

相关问题 更多 >