Virtualenv python-ldap安装错误



请不要说这是复制品。

到目前为止,所有的答案都只是通过全局安装ldap和其他开发包来"解决"问题,这并不能解决无法在虚拟环境中安装python-ldap包的问题。

的例子包括:如何在Ubuntu的虚拟环境中安装python-ldap ?

sudo apt-get install libsasl2-dev python-dev libldap2-dev libssl-dev

我在虚拟环境中使用ubuntu 14.04, python 2.7和flask。

当我运行pip install python-ldap时,我收到以下错误:

    copying Lib/ldap/schema/__init__.py -> build/lib.linux-x86_64-2.7/ldap/schema
copying Lib/ldap/schema/models.py -> build/lib.linux-x86_64-2.7/ldap/schema
copying Lib/ldap/schema/subentry.py -> build/lib.linux-x86_64-2.7/ldap/schema
copying Lib/ldap/schema/tokenizer.py -> build/lib.linux-x86_64-2.7/ldap/schema
copying Lib/ldap/syncrepl.py -> build/lib.linux-x86_64-2.7/ldap
file Lib/ldap.py (for module ldap) not found
file Lib/ldap/controls.py (for module ldap.controls) not found
file Lib/ldap/extop.py (for module ldap.extop) not found
file Lib/ldap/schema.py (for module ldap.schema) not found
running egg_info
writing requirements to Lib/python_ldap.egg-info/requires.txt
writing Lib/python_ldap.egg-info/PKG-INFO
writing top-level names to Lib/python_ldap.egg-info/top_level.txt
writing dependency_links to Lib/python_ldap.egg-info/dependency_links.txt
warning: manifest_maker: standard file '-c' not found
file Lib/ldap.py (for module ldap) not found
file Lib/ldap/controls.py (for module ldap.controls) not found
file Lib/ldap/extop.py (for module ldap.extop) not found
file Lib/ldap/schema.py (for module ldap.schema) not found
reading manifest file 'Lib/python_ldap.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'Makefile'
warning: no files found matching 'Modules/LICENSE'
writing manifest file 'Lib/python_ldap.egg-info/SOURCES.txt'
running build_ext
building '_ldap' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/Modules
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DHAVE_SASL -DHAVE_TLS -DHAVE_LIBLDAP_R -DHAVE_LIBLDAP_R -DLDAPMODULE_VERSION=2.4.21 -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
Modules/LDAPObject.c:18:18: fatal error: sasl.h: No such file or directory
 #include <sasl.h>
                  ^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Command "/home/kmertig/hd_request/hd_request/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-V4vhsl/python-ldap/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('rn', 'n'), __file__, 'exec'))" install --record /tmp/pip-NIR67Y-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/kmertig/hd_request/hd_request/include/site/python2.7/python-ldap" failed with error code 1 in /tmp/pip-build-V4vhsl/python-ldap

如果我尝试pip安装任何建议的开发库,以便它们位于我的虚拟环境中,我会得到以下错误:

  Could not find a version that satisfies the requirement libsasl2-dev (from versions: ) No matching distribution found for libsasl2-dev

我可以全局安装所有这些东西,但这显然违背了使用virtualenv的目的。

我真的很想找到一个有意义的,虚拟的解决方案,因为我所能找到的是一个虚拟问题的非虚拟的解决方案。

谢谢。

Python包 Python -ldap需要一些不是Python库的其他库( libsass2 -dev,…)(因此您不能使用pip来安装它们)。所以,要使用它们,你必须安装它们。两种解决方案:

  • 使用包管理器安装它们(例如:apt-get);
  • 下载它们的源代码并在本地(在您的虚拟环境中)编译它们(在特殊情况下对某些库很有用)。

也许你可以试试第二种解决方案?

相关内容

  • 没有找到相关文章

最新更新