首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在python3.10/ windows 10中成功导入ldap3 (0.9.8.4)

如何在python3.10/ windows 10中成功导入ldap3 (0.9.8.4)
EN

Stack Overflow用户
提问于 2022-02-01 08:28:22
回答 1查看 1.2K关注 0票数 0

我正在使用Python3.10,并希望建立一个LDAP连接。所以我尝试了ldap3(0.9.8.4)。

我的项目进展顺利。

我的代码:

代码语言:javascript
复制
import sys
sys.path.append('C:\\Users\\User\\Python\\pyproj\\project1\\Lib\\site-packages\\python3-ldap-0.9.8.4')
import pyasn1
from collections.abc import MutableMapping
from ldap3 import Connection


#server = Server('ip')
#con=Connection(server,'user','password',auto_bind=True)
#print(con)

我所犯的错误:

代码语言:javascript
复制
Traceback (most recent call last):
  File "C:\Users\User\Python\pyproj\project1\myldap.py", line 5, in <module>
    from ldap3 import Connection
  File "C:\Users\User\Python\pyproj\project1\Lib\site-packages\python3-ldap-0.9.8.4\ldap3\__init__.py", line 254, in <module>
    from .core.server import Server
  File "C:\Users\User\Python\pyproj\project1\Lib\site-packages\python3-ldap-0.9.8.4\ldap3\core\server.py", line 35, in <module>
    from ..protocol.rfc4512 import SchemaInfo, DsaInfo
  File "C:\Users\User\Python\pyproj\project1\Lib\site-packages\python3-ldap-0.9.8.4\ldap3\protocol\rfc4512.py", line 33, in <module>
    from ..utils.conv import escape_bytes, json_hook, check_json_dict, format_json, check_escape
  File "C:\Users\User\Python\pyproj\project1\Lib\site-packages\python3-ldap-0.9.8.4\ldap3\utils\conv.py", line 30, in <module>
    from ..utils.ciDict import CaseInsensitiveDict
  File "C:\Users\User\Python\pyproj\project1\Lib\site-packages\python3-ldap-0.9.8.4\ldap3\utils\ciDict.py", line 31, in <module>
    class CaseInsensitiveDict(collections.MutableMapping):
AttributeError: module 'collections' has no attribute 'MutableMapping'

当我只导入sys、pyasn1和ldap3时,我使用了同样的错误之后使用了ldap3。

我安装的模块:

代码语言:javascript
复制
altgraph==0.17.2
click @ file:///C:/Users/User/Python/modules/click-8.0.3-py3-none-any.whl
cmake @ file:///C:/Users/User/Python/modules/cmake-3.22.1-py2.py3-none-win_amd64.whl
colorama @ file:///C:/Users/User/Python/modules/colorama-0.4.4-py2.py3-none-any.whl
cycler @ file:///C:/Users/User/Python/modules/cycler-0.11.0-py3-none-any.whl
Cython @ file:///C:/Users/User/Python/modules/Cython-3.0.0a9-cp310-cp310-win_amd64.whl
Flask @ file:///C:/Users/User/Python/modules/Flask-2.0.2-py3-none-any.whl
fonttools @ file:///C:/Users/User/Python/modules/fonttools-4.29.0-py3-none-any.whl
future==0.18.2
imutils==0.5.4
itsdangerous @ file:///C:/Users/User/Python/modules/itsdangerous-2.0.1-py3-none-any.whl
Jinja2 @ file:///C:/Users/User/Python/modules/Jinja2-3.0.3-py3-none-any.whl
kiwisolver @ file:///C:/Users/User/Python/modules/kiwisolver-1.3.2-cp310-cp310-win_amd64.whl
MarkupSafe @ file:///C:/Users/User/Python/modules/MarkupSafe-2.0.1-cp310-cp310-win_amd64.whl
matplotlib @ file:///C:/Users/User/Python/modules/matplotlib-3.5.1-cp310-cp310-win_amd64.whl
numpy @ file:///C:/Users/User/Python/modules/numpy-1.22.1-cp310-cp310-win_amd64.whl
opencv-python @ file:///C:/Users/User/Python/modules/opencv_python-4.5.5-cp310-cp310-win_amd64.whl
packaging==21.3
paho-mqtt==1.6.1
pefile==2021.9.3
Pillow @ file:///C:/Users/User/Python/modules/Pillow-9.0.0-cp310-cp310-win_amd64.whl
pyasn1 @ file:///C:/Users/User/Python/modules/pyasn1-0.4.8-py2.py3-none-any.whl
pyasn1-modules @ file:///C:/Users/User/Python/modules/pyasn1_modules-0.2.8-py2.py3-none-any.whl
pyinstaller==5.0.dev0
pyinstaller-hooks-contrib==2021.5
pyparsing==3.0.7
python-dateutil @ file:///C:/Users/User/Python/modules/python_dateutil-2.8.2-py2.py3-none-any.whl
python3-ldap==0.9.8.4
pywin32-ctypes==0.2.0
scikit-build==0.12.0
six @ file:///C:/Users/User/Python/modules/six-1.16.0-py2.py3-none-any.whl
Werkzeug @ file:///C:/Users/User/Python/modules/Werkzeug-2.0.2-py3-none-any.whl

也许有些可以帮助我建立ldap连接?

问候,法定人数

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-02-01 08:50:10

为此,我认为Idap3 0.9.8.3是python10的旧版本。如果你尝试,最新的可以解决你的问题。pip install ldap3,这对我来说很好。建立一个成功的连接。如果您需要任何帮助,请在下面评论。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/70937454

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档