windows下安装Python库的一系列错误

1.

 error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools

这个的解决办法是手动下载需要安装的那个包,比如我需要安装的是imread,在https://www.lfd.uci.edu/~gohlke/pythonlibs/这个网站下,搜索你需要的包,注意版本。然后将下载的whl包(我的是

然后在命令行中cd到这个目录,然后输入命令:pip install + 包名,我的是:

pip install imread-0.6.1-cp36-cp36m-win32.whl

2.如果版本选错了,会出现如下错误:*** is not a supported wheel on this platform.如我的:

imread-0.6.1-cp36-cp36m-win_amd64.whl is not a supported wheel on this platform.

解决方法,需要查看pip支持的哪些符号,运行如下命令:

amd64:cpu是x64的,(注意并不是指操作系统是64位的)

import pip._internal
print(pip._internal.pep425tags.get_supported())

win32:指Windows操作系统

import pip
print(pip.pep425tags.get_supported())
如果出现如下错误说明用错了命令,用上面两个命令中的另一个就行了。
AttributeError: module 'pip' has no attribute 'pep425tags'
成功后可以看到


出现了pip支持的符号,里面表明我们应该用cp36,win32的版本。所以在上面那个网站下载即可:

https://www.lfd.uci.edu/~gohlke/pythonlibs/

猜你喜欢

转载自blog.csdn.net/lwgkzl/article/details/80545488