win10 安裝python-ldap

windows 安裝python-ldap
一般通過 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

接下來繼續(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

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

友情鏈接更多精彩內(nèi)容