Windows 使用 pip 安裝 python-ldap

LDAP是輕量目錄訪問協議,英文全稱是Lightweight Directory Access Protocol,通常都簡稱爲LDAP,Windows 使用 pip 安裝 python-ldap 時,提示找不到lber.h,本文介紹如何安裝。python

安裝問題

pip install python-ldap

安裝python-ldap提示找不到lber.h,錯誤日誌:app

c:\users\administrator\appdata\local\temp\pip-install-plurkp\python-ldap\modules\constants.h(7) : fatal error C1083: Cannot open include file: 'lber.h': No such file or directory
error: command 'C:\\Users\\Administrator\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\cl.exe' failed with exit status 2

解決辦法

安裝 whl 包:https://www.lfd.uci.edu/~gohlke/pythonlibs/#python-ldapui

$ pip install pyldap-2.4.45-cp27-cp27m-win32.whl
Looking in indexes: http://mirrors.aliyun.com/pypi/simple/
Processing c:\users\administrator\downloads\pyldap-2.4.45-cp27-cp27m-win32.whl
Requirement already satisfied: setuptools in d:\pythonenv\blueking\lib\site-packages (from pyldap==2.4.45) (39.1.0)
Installing collected packages: pyldap
Successfully installed pyldap-2.4.45

spa

pip install python_ldap-3.1.0-cp27-cp27m-win32.whl

完畢。日誌

相關文章
相關標籤/搜索