安装环境:win7 64位 python3.8
问题描述:在pip install request-html 时出现lxml插件安装失败。提示:Microsoft Visual C++ 14.0 is required
两种方法:1.按提示安装Microsoft Visual C++ 14.0;
2.找单独的lxml.whl文件下载安装。
我选的第二种(第一种下载费时,安装时提示加入什么用户体验,还强制的)
下载whl文件还是在官网下载
https://pypi.org/project/lxml/#files
下载前确认下适配你开发环境的版本。否则提示当前版本不支持该系统
is not a supported wheel on this platform
版本的确定:
在python环境下执行:
AMD64
import pip._internal
print(pip._internal.pep425tags.get_supported())
WIN32
import pip
print(pip.pep425tags.get_supported())
控制台会打印出适配的版本号
>>> import pip._internal
>>> print(pip._internal.pep425tags.get_supported())
[('cp38', 'cp38m', 'win_amd64'), ('cp38', 'none', 'win_amd64'), ('py3', 'none', 'win_amd64'), ('cp38', 'none', 'any'), ('cp3', 'none', 'any'),
('py38', 'none', 'any'), ('py3', 'none', 'any'), ('py37', 'none', 'any'), ('py36', 'none', 'any'), ('py35', 'none', 'any'), ('py34', 'none', 'a
ny'), ('py33', 'none', 'any'), ('py32', 'none', 'any'), ('py31', 'none', 'any'), ('py30', 'none', 'any')]
找到对应的文件下载。到了官网只有
lxml-4.6.2-cp38-cp38-win_amd64.whl
最匹配,先下载安装试下
安装前还要安装wheel(安装过就不需要,否则会不识别whl文件)
pip install wheel
再安装lxml
pip intall [完整路径]\lxml-4.6.2-cp38-cp38-win_amd64.whl
结果提示is not a supported wheel on this platform。下载了其他几个版本都是同样的提示。
无解的情况下,把文件重命名成:lxml-4.6.2-cp38-cp38m-win_amd64.whl 【cp38 改为cp38m】,再试居然可以了。