Windows 使用 pip 安裝 python-ldap
阿新 • • 發佈:2019-04-28
LDAP是輕量目錄訪問協議,英文全稱是Lightweight Directory Access Protocol,一般都簡稱為LDAP,Windows 使用 pip 安裝 python-ldap 時,提示找不到lber.h,本文介紹如何安裝。
安裝問題
pip install python-ldap
安裝python-ldap提示找不到lber.h,錯誤日誌:
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-ldap
$ 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
或
pip install python_ldap-3.1.0-cp27-cp27m-win32.whl