windows 安裝python-ldap
一般通過(guò) pip install python_ldap
linux 環(huán)境 該包依賴 gc++ 而在Windows平臺(tái) 需要先安裝 Microsoft Visual C++ 14.0
否則會(huì)報(bào)錯(cuò)
error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/ Tools":
解決方式:安裝Microsoft Visual C++ Build Tools
下載鏈接: https://link.zhihu.com/?target=http%3A//go.microsoft.com/fwlink/%3FLinkId%3D691126
接下來(lái)繼續(xù)安裝報(bào)錯(cuò):
c:\users\XXX\appdata\local\temp\pip-install-f2xxzhp0\python-ldap\modules\common.h(15): fatal error C1083: Cannot open include file: 'lber.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit status 2
因?yàn)閃indows環(huán)境的差異凌外, 需要安裝擴(kuò)展包,因此先下載 擴(kuò)展包
下載鏈接:https://www.lfd.uci.edu/~gohlke/pythonlibs/#python-ldap
注意選擇合適的版本混弥,我用的 python3.7 x64系統(tǒng)趴乡, 因此下載 python_ldap-3.3.1-cp37-cp37m-win_amd64.whl 安裝成功
安裝方式对省, 在下載的目錄 運(yùn)行
pip install python_ldap-3.3.1-cp37-cp37m-win_amd64.whl
或
pip install C:\Users\XXX\Downloads\python_ldap-3.3.1-cp37-cp37m-win_amd64.whl #指定文件全路徑
文章參考:https://zhuanlan.zhihu.com/p/126669852
文章參考:https://blog.csdn.net/weixin_38308549/article/details/89709186