virtualenv python-ldap 安装错误 [英] virtualenv python-ldap install error

查看:72
本文介绍了virtualenv python-ldap 安装错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请不要称之为重复.

目前所有的答案都只是通过全局安装ldap等开发包的方式解决"了问题,并没有解决无法在虚拟环境中安装python-ldap包的问题.

All the answers have so far only 'solved' the problem by installing the ldap and other development packages globally, which doesn't solve the problem of not being able to install the python-ldap package in the virtual environment.

示例包括:如何在 virtualenv 中安装 python-ldap在 Ubuntu 上?

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

我在我的虚拟环境中使用 ubuntu 14.04、python 2.7 和 Flask.

I am using ubuntu 14.04, python 2.7 and flask in my virtual environment.

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

When I run pip install python-ldap, I receive the following error.

    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('\r\n', '\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 install 任何建议的开发库,以便它们在我的虚拟环境中,我会收到以下错误.

If I try to pip install any of the suggested dev libraries so that they are inside my virtual environment, I get the following error.

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

我可以在全球范围内安装所有这些东西就好了,但这显然违背了使用 virtualenv 的目的.

I can install all this stuff globally just fine, but that just plain defeats the purpose of using virtualenv.

我真的很想找到一个有意义的 virtualenv 解决方案,因为我所能找到的只是针对 virtualenv 问题的非 virtualenv 解决方案.

I would really like to find a meaningful, virtualenv solution, since all I have been able to find is non-virtualenv solutions for a virtualenv question.

谢谢.

推荐答案

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

The Python package python-ldap requires some other libs (libsasl2-dev, …) which are not python libs (so you can't use pip to install them). So, to use them, you have to install them. Two solutions:

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

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

Maybe you can try the second solution?

这篇关于virtualenv python-ldap 安装错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆