示例庫: python-ldap
系統: Microsoft Windows [版本 10.0.18363.836]
Python版本: Python 3.7.4
pip版本: pip 20.1.1
常規流程
pip安裝: pip install python-ldap
安裝報錯, 大概意思就是缺少必須的vc++庫, 很多python庫安裝時都需要依賴vc++庫, 但是我們不需要安裝vc++庫也能解決這個問題, 就是使用.whl 文件安裝
whl文件下載地址
下載最新的amd-64的whl文件, 然後使用pip install xxx.whl安裝…
…是不是覺得會安裝成功…too young too simple…
is not a supported wheel on this platform…平臺不支持, 那怎樣查看支持哪些平臺呢?
下面是網上羅列的幾種方法…
# WIN32
import pip
print(pip.pep425tags.get_supported()
報錯: AttributeError: module ‘pip’ has no attribute 'pep425tags’
# AMD64
import pip._internal
print(pip._internal.pep425tags.getsupported())
報錯: AttributeError: module ‘pip._internal’ has no attribute 'pep425tags’
然後還有這樣的…
import pip._internal.pep425tags
print(pip._internal.pep425tags.get_supported())
直接導包報錯…不知道那位童鞋是怎麼搞定的…
最後在stackoverflow找的解決辦法
# 先安裝wheel庫
pip install wheel
# 查看支持的版本
import wheel.pep425tags as w
print(w.get_supported(archive_root=""))
再去下載對應的包…
安裝成功…
上面的幾種寫法應該都沒有問題, 應該只是pip版本的問題…如果遇到類似缺少VC++庫的問題時可以都嘗試下…