在Centos上的虚拟环境中安装pythonldap

2024-09-28 20:56:12 发布

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

在其他问题的帮助下,我成功地安装了pythonldap。在

[root@test myproj]# python test.py
[]

但在虚拟环境中,我得到“没有名为ldap的模块”

^{pr2}$

尝试安装-我得到一个很长的错误消息,但我认为重要的是这一点

gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DHAVE_SASL -DHAVE_TLS -DHAVE_LIBLDAP_R -DHAVE_LIBLDAP_R -DLDAPMODULE_VERSION=2.4.43 -IModules -I/usr/include -I/usr/include/sasl -I/usr/local/include -I/usr/local/include/sasl -I/usr/include/python2.7 -c Modules/LDAPObject.c -o build/temp.linux-x86_64-2.7/Modules/LDAPObject.o

unable to execute gcc: No such file or directory

error: command 'gcc' failed with exit status 1

正在尝试安装依赖项

(venv)[root@test socportal]# venv/bin/pip install python-dev
Downloading/unpacking python-dev
  Could not find any downloads that satisfy the requirement python-dev
Cleaning up...
No distributions at all found for python-dev
Storing complete log in /root/.pip/pip.log

我已经试着安装这个库5个多小时了,到处找。 急需帮助。在


Tags: pipdevtestsourceincludeusrrootgcc
1条回答
网友
1楼 · 发布于 2024-09-28 20:56:12

从您的错误消息来看,似乎没有安装gcc编译器,但是需要它来编译您尝试安装的python包。在

以root用户身份运行(或使用sudo),使用

yum install gcc

更进一步说,“开发工具”组中提供了其他方便的开发包,包括gcc。以root用户身份运行(或使用sudo),可以使用以下方式安装:

^{pr2}$

相关问题 更多 >