Centos虚拟环境安装python-ldap
Install python-ldap in virtual environment on Centos
我在其他问题的帮助下成功安装了 python-ldap。
[root@test myproj]# python test.py
[]
但是在虚拟环境中,我得到这个"No module named ldap"
(venv)[root@test myproj]# python test.py
Traceback (most recent call last):
File "test.py", line 1, in <module>
import ldap
ImportError: No module named ldap
正在尝试安装 - 我收到一条很长的错误消息,但我认为重要的是这个
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 个多小时了,四处寻找。
迫切需要帮助。
从您的错误消息来看,似乎没有安装 gcc 编译器,但需要编译您尝试安装的 python 包。
运行 以 root 身份(或使用 sudo),使用
安装
yum install gcc
更进一步,"Development Tools" 组中还有其他方便的开发包,包括 gcc。 运行 作为 root,(或使用 sudo),你可以安装它:
yum groupinstall “Development Tools”
我在其他问题的帮助下成功安装了 python-ldap。
[root@test myproj]# python test.py
[]
但是在虚拟环境中,我得到这个"No module named ldap"
(venv)[root@test myproj]# python test.py
Traceback (most recent call last):
File "test.py", line 1, in <module>
import ldap
ImportError: No module named ldap
正在尝试安装 - 我收到一条很长的错误消息,但我认为重要的是这个
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 个多小时了,四处寻找。 迫切需要帮助。
从您的错误消息来看,似乎没有安装 gcc 编译器,但需要编译您尝试安装的 python 包。
运行 以 root 身份(或使用 sudo),使用
安装yum install gcc
更进一步,"Development Tools" 组中还有其他方便的开发包,包括 gcc。 运行 作为 root,(或使用 sudo),你可以安装它:
yum groupinstall “Development Tools”