以安装库顺序与出现各种error可能性顺序叙述
一、按照正常教程_使用国内源pip安装
在安装python第三方库pandas(后测试时发现多个第三方库在此时都会出现这类问题)的时候,最初使用pip安装时安装成功,可以imprt PIL,但是当运行from pIL import image 的时候,就会报错,说没有这个model。
在转至下一步前,先确定是否是由于其他问题引起的
1、首先确定是否安装pandas:确定/site-package文件夹中含有pandas
2、确定安装了pandas但无法识别出来,输入pip show pandas 查看能否输出pandas详细信息。
A、在输出的详细信息中查看pandas版本,查看是否存在pandas版本过老的问题
B、如果不能输出详细信息,显示无法找到“pandas”
a、因为pythonpath中设置的路径不正确。在windows中下载了多个python,在设置环境变量-系统变量-PATH时,将其他python的路径设在所用python的路径之上。
Ps:C:\msys64\mingw64\bin这一个路径不仅指向了其中的C++,还指向了其中的python,当这一个路径位于你本想使用的python的路径之上时,指向的python为C:\msys64\mingw64\bin中的python。假如你使用的python为anaconda或者其他python,应该将所使用的python路径置于更上方。
出现error形式如下(× Getting requirements to build wheel did not run successfully.)
Getting requirements to build wheel ... error
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [3 lines of output]
setup.py:117: UserWarning: Unable to determine GEOS version. Ensure you have 3.7.2 or later installed, or installation may fail.
warnings.warn(
Proj 8.0.0 must be installed.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.
error形式与下列error形式相同,而且使用.whl文件下载并无效果,依旧会出现此error形式报错,但其实只需更改环境变量-系统变量-PATH的设置即可。
假如出现此问题,有大概率同时存在由于更新了自身pip版本导致路径更新的问题,故在此增述。若确有其事,在更正了环境变量-系统变量-PATH的设置之后,可按照下列教程配置pip install默认安装路径,避免再使用pip下载的库安装至其他python的site-package文件夹中
b、如果是使用anaconda,则可能存在conda list与pip list之间的不相同问题:(下列引用一篇文章具体阐述两个指令之间区别所在)同一个虚拟环境下的conda list和pip list里的包不一样,这是为什么,它们有什么区别_程序猿的探索之路的博客-CSDN博客https://blog.csdn.net/nyist_yangguang/article/details/111304014
如果也是上述B类情况,将anaconda中所虚拟的python环境路径置于C:\msys64\mingw64\bin之上即可,pip路径设置好之后,conda和pip所读取的python库就都为anaconda所虚拟的python环境文件夹中的/Lib/site-package中的库
据说是官方库本身有问题,于是尝试.whl文件pip 方式安装
二、使用.whl文件pip方式安装
MSYS2版流程: 与上列教程在流程大致一致
区别在于使用pip debug --verbose指令时,所输出的compatible tags中,后缀并不是cpxx-cpxx-win_amd64或者cpxx-abi3-win_amd64,而多为cpxx-abi3-mingw_x86_64
在网站https://www.lfd.uci.edu/~gohlke/pythonlibs中是找不到这个后缀的.whl文件的,所以自行根据自己的python版本和位数选择相对应的.whl文件
在选择好.whl文件下载后,自行将后缀改成所需的后缀。形如:Pillow-9.1.1-cp39-abi3-mingw_x86_64.whl,即可正常按照上列教程下载
三、VC 6.0 is not supported by this module
使用上述一、二两种方式,即直接pip install或者conda install、和使用.whl下载时都出现此形式error(包括不限于pandas、numpy、opencv、deepface)
出现error形式如下:
distutils.errors.DistutilsPlatformError: VC 6.0 is not supported by this module
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
error原因:MSYS2 patches setuptools to work with GCC and the MSYS2 Python, so you can't use setuptools as is from pip.
1、摘自github中python第80720issues的解决方法一:
See https://github.com/msys2/MINGW-packages/tree/master/mingw-w64-python-setuptools for the current set of patches.
2、摘自github中python第80720issues的解决方法二:
删除现有的setuptools,转而使用pacman repo中的setuptools(删除需谨慎)
pip uninstall setuptools
pacman -S mingw-w64-x86_64-python-setuptools
如果使用的是 python3:
pip3 uninstall setuptools
pacman -S mingw-w64-x86_x64-python3-setuptools