我使用Windows作为我的主要python 2.7开发环境,我想在虚拟环境中安装python-ldap.
python-ldap包需要编译:(当然我无法在我的环境中编译它.所以我尝试通过easy_install在我的虚拟环境中安装二进制文件(FYI你可以做easy_install package.exe和包将安装).我在这里找到了分布式二进制文件:https://pypi.python.org/pypi/python-ldap/
不幸的是,他们只为python 2.7提供.msi包!为什么人们使用.msi?MSI不能通过easy_install安装.我讨厌MSI%$#$ ^#$ ^#$
是的我可以通过执行它来安装.msi包,但它将安装在全局python包中,而不是安装在我的虚拟环境中!
拜托,有人可以帮帮我吗?我记得在之前的项目中遇到了这个确切的问题,我不得不在虚拟环境之外开发它 - 但我现在不能这样做:(
更新:我在系统范围内安装了python-ldap并将目录ldap和python_ldap-2.4.10-py2.7.egg-info从PYTHON_GLOBAL\Lib\site-packages复制到VIRTUALENV\Lib\site-packages并且似乎正在运行现在.但是我真的不喜欢这个解决方案所以我不会回答我的问题.此外,Alexander关于使用--system-site-packages重新创建virtualenv的评论可能会起作用,但这意味着我需要卸载我的许多全局软件包,然后重新安装我的虚拟软件包等,一般情况下它不是干:(
更新2:在尝试cgohlke的建议之后,我看到MSI的内容是我上面提到的两个目录以及文件dsml.py,ldapurl.py和ldif.py. 所以我也把它复制到了我的VIRTUALENV\Lib\site-packages.现在我相信安装还可以:).但我相信cgohlke是最好的 - 只需使用msiexec.exe将msi的内容直接提取到您的VIRTUALENV.
更新3:在一个类似的问题(在Windows上的virtualenv中安装python-ldap)我发现了一个非常有趣的链接:http://www.lfd.uci.edu/~gohlke/pythonlibs/#python-ldap.在那里你将能够找到python-ldap和其他很多的.EXE安装包!所以最后通过下载这些你将能够easy_install在你的virtualenv他们!
最近,我花了几个小时撕掉我的头发(或者剩下的东西)试图将python-ldap(通过pip)安装到Redhat Enterprise服务器上.
这是我会得到的错误消息(看起来很熟悉?):
Modules/constants.c:365: error: ‘LDAP_CONTROL_RELAX’ undeclared (first use in this function)
error: command 'gcc' failed with exit status 1
如果只有那里有人可以帮助我!
我在我的Bluemix应用程序中安装sasl时出现以下错误:
Installing collected packages: sasl, thrift-sasl
Running setup.py install for sasl: started
Running setup.py install for sasl: finished with status 'error'
Command "/app/.heroku/python/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-9mi8225r/sasl/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-3l4o04ga-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-9mi8225r/sasl/
running install
running build_py
creating build
creating build/lib.linux-x86_64-3.5
creating build/lib.linux-x86_64-3.5/sasl
copying sasl/__init__.py -> build/lib.linux-x86_64-3.5/sasl
running egg_info
writing dependency_links to sasl.egg-info/dependency_links.txt
writing top-level names to sasl.egg-info/top_level.txt
warning: manifest_maker: standard file '-c' not found
reading manifest file …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 pip 安装 python-ldap 包。执行时出现以下错误pip install python-ldap。我尝试根据此问题安装与 ubuntu 17.10 ( Artful ) 对应的软件包,但还没有运气。我错过了什么包裹?
上述堆栈溢出问题中的解决方案是安装
sudo apt-get install libsasl2-dev python-dev libldap2-dev libssl-dev
但在 17.10 中我看不到libsasl2-dev&libldap2-dev而是我可以看到包libsasl-2-2& libldap-2.4-2。我和phthon-dev&一起安装了它们libssl-dev。但我仍然收到以下错误。似乎我缺少一些包含 lber.h 文件的软件包安装。
我得到的错误:
In file included from Modules/LDAPObject.c:8:0:
Modules/constants.h:7:10: fatal error: lber.h: No such file or directory
#include "lber.h"
^~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
Run Code Online (Sandbox Code Playgroud)
Python 版本 - 3.6.3
点子版本 - 19.1.1
我一直在收到GCC编译错误:
$ pip install python-ldap
...
compilation terminated.
error: command 'gcc' failed with exit status 1
Run Code Online (Sandbox Code Playgroud) 我正在使用ldap身份验证模块的Django项目中进行工作。这正在我们的服务器上运行,但是我在将其运行在Windows dev机器上时遇到了问题。
我的环境正在使用virtualevn,当尝试安装pip python-ldap时,我收到以下消息:
error: Unable to find vcvarsall.bat
Run Code Online (Sandbox Code Playgroud)
有谁知道会出什么问题吗?
我正在尝试使用 PyCharm 安装 python-ldap 包,但它不起作用,出现以下错误:
错误信息:
使用缓存收集 python-ldap https://files.pythonhosted.org/packages/7f/1c/28d721dff2fcd2fef9d55b40df63a00be26ec8a11e8c6fc612ae642f9cfd/python-ldap-3.1.0.tar.gz 使用缓存收集 pyasn1>=0.3.7 (来自 python-ldap)https://files.pythonhosted.org/packages/a0/70/2c27740f08e477499ce19eefe05dbcae6f19fdc49e9e82ce4768be0643b9/pyasn1-0.4.3-py2.py3-none-any.whl 收集pyasn1_modules>=0.1.5(来自python-ldap)使用缓存https: //files.pythonhosted.org/packages/e9/51/bcd96bf6231d4b2cc5e023c511bee86637ba375c44a6f9d1b4b7ad1ce4b9/pyasn1_modules-0.2.1-py2.py3-none-any.whl 安装收集的软件包:pyasn1、pyasn1-modules、python-ld ap 运行 setup.py install for python-ldap:开始运行 python-ldap 的 setup.py 安装:完成状态为“错误”命令 C:\Users\Joan\PycharmProjects\prueba\venv\Scripts\python.exe -u -c "import setuptools 的完整输出, tokenize; file ='C:\Users\Joan\AppData\Local\Temp\pycharm-packaging\python-ldap\setup.py';f=getattr(tokenize, 'open', open)(文件);code= f.read().replace('\r\n', '\n');f.close();exec(编译(代码,文件,'exec'))”安装--记录C:\ Users \ Joan \ AppData \ Local \ Temp \ pip-record-y2ot_u84 \ install-record.txt--单一版本-外部管理--编译--安装-headers C:\Users\Joan\PycharmProjects\prueba\venv\include\site\python3.6\python-ldap:运行安装运行构建运行 build_py 创建 build\lib.win-amd64-3.6 复制 Lib\ldapurl.py - > build\lib.win-amd64-3.6 复制 Lib\ldif.py -> build\lib.win-amd64-3.6 创建 build\lib.win-amd64-3.6\ldap 复制 Lib\ldap\async.py -> 构建\lib.win-amd64-3.6\ldap 复制 Lib\ldap\asyncsearch.py -> …
我正在尝试在 Docker 中 pip install python-ldap 但缺少 lber.h。我需要 python-ldap 因为我正在尝试为我的应用程序实现一个与操作系统无关的 SSO,现在遵循此方法并希望它不会破坏我的应用程序的其余部分https://code.tutsplus.com/tutorials/flask-authentication -with-ldap--cms-23101
我努力了
RUN apk add libsasl2-dev libldap2-dev libssl-dev
和
RUN apk --no-cache add libsasl2-dev libldap2-dev libssl-dev
但我收到以下错误:
ERROR: unsatisfiable constraints:
libldap2-dev (missing):
required by: world[libldap2-dev]
libsasl2-dev (missing):
required by: world[libsasl2-dev]
libssl-dev (missing):
required by: world[libssl-dev]
Run Code Online (Sandbox Code Playgroud)
访问https://pkgs.alpinelinux.org/packages?name=libldap2-dev&branch=edge我觉得这些包可能确实不存在于 alpine python 映像中。因此,我尝试用上述链接中存在的软件包替换安装,即: openssl libsasl libldap 这也不起作用,并且与不安装任何软件包具有相同的效果,即出现标头丢失错误:
Modules/constants.h:7:10: 致命错误: lber.h: 没有这样的文件或目录
#include "lber.h"
^~~~~~~~
compilation terminated.
error: command 'gcc' failed with exit status 1
Run Code Online (Sandbox Code Playgroud)
后果/tmp/pip-install-doifa8k9/python-ldap/
我的 Dockerfile:
FROM python:3.8.0-alpine …Run Code Online (Sandbox Code Playgroud) 我正在使用docker构建Django实现。我使用python容器作为基础,但是在我的需求文件中,我有以下内容:
boto==2.43.0
boto3==1.4.4
botocore==1.5.55
ciscoconfparse==1.2.47
Django==1.11.4
django-appconf==1.0.2
django-auth-ldap==1.2.10
django-dbtemplates==2.0
django-debug-toolbar==1.7
easy-thumbnails==2.3
easysnmp==0.2.4
ipaddress==1.0.18
Jinja2==2.9.5
mysqlclient-1.3.10
netmiko==1.2.8
O365==0.9.5
orionsdk==0.0.6
paramiko==2.1.2
python-dateutil==2.6.0
python-ldap==2.4.32
pytz==2016.10
pyOpenSSL==17.2.0
sqlparse==0.2.3
urllib3==1.21.1
joblib==0.11
Run Code Online (Sandbox Code Playgroud)
其中一些依赖项在单独使用python容器时会失败,例如...
#include <net-snmp/net-snmp-config.h>
^
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
Failed building wheel for easysnmp
...
...
#include "lber.h"
^
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
Failed building wheel for pyldap
...
...
In file included from Modules/LDAPObject.c:9:0:
Modules/errors.h:8:18: fatal error: lber.h: No such …Run Code Online (Sandbox Code Playgroud) python ×7
python-ldap ×4
virtualenv ×3
docker ×2
ldap ×2
pip ×2
buildpack ×1
django ×1
easy-install ×1
ibm-cloud ×1
pycharm ×1
python-3.6 ×1
python-3.x ×1
redhat ×1
ubuntu ×1
ubuntu-17.10 ×1