安装cv2指的是opencv-python
Step1:激活想要安装的所在虚拟环境
然后安装
pip install opencv-python
Step2:激活想要安装的所在虚拟环境
Step3:检测是否可用
没有报错就是安装完成。
安装numpy,遇到的错误及解决办法
Step1:激活想要安装的所在虚拟环境Pip install numpy
(黄色字部分为原因及解决办法)一般第一次安装使不会出错的,如果出错的话可能是因为安装别的第三方库,包等,二次下载,导致 。
- 有俩个版本的numpy,系统不知应用哪个版本所以会出错
- 卸载重装(pycharm,conda都要卸载)
查看nump版本代码:
import numpy
print(numpy.__path__)
print(numpy.version.version)
如果运行其他文件,提示numpy错误,可能是numpy版本低的问题。
先pip uninstall numpy,确保完全卸载numpy,再pip install -U numpy
对numpy进行指定版本(假如指定1.14.5版本)
Pip install -U numpy==1.14.5 -i
遇到的问题及解决
问题一:
D:\Anaconda\envs\deepface\python.exe F:/EmotionProjects/Smile_Detector-master/numpybanben.py
D:\Anaconda\envs\deepface\lib\site-packages\numpy\__init__.py:148: UserWarning: mkl-service package failed to import, therefore Intel(R) MKL initialization ensuring its correct out-of-the box operation under condition when Gnu OpenMP had already been loaded by Python process is not assured. Please install mkl-service package, see GitHub - IntelPython/mkl-service: Python hooks for Intel(R) Math Kernel Library runtime control settings. from . import _distributor_init
Traceback (most recent call last):
File"D:\Anaconda\envs\deepface\lib\site-packages\numpy\core\__init__.py", line 22, in <module>from . import multiarrayFile"D:\Anaconda\envs\deepface\lib\site-packages\numpy\core\multiarray.py", line 12, in <module>
from . import overrides
File"D:\Anaconda\envs\deepface\lib\site-packages\numpy\core\overrides.py", line 7, in <module>
from numpy.core._multiarray_umath import (
ImportError: DLL load failed: 找不到指定的模块。
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File"F:/EmotionProjects/Smile_Detector-master/numpybanben.py", line 1, in <module>
ImportnumpyFile"D:\Anaconda\envs\deepface\lib\site-packages\numpy\__init__.py", line 150, in <module>
from . import core File "D:\Anaconda\envs\deepface\lib\site-packages\numpy\core\__init__.py", line 48, in <module>
raise ImportError(msg)
ImportError:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was installed.
We have compiled some common reasons and troubleshooting tips at: https://numpy.org/devdocs/user/troubleshooting-importerror.html
Please note and check the following:
* The Python version is: Python3.7 from "D:\Anaconda\envs\deepface\python.exe"
* The NumPy version is: "1.21.5"
and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.
Original error was: DLL load failed: 找不到指定的模块。
解决办法1:
在anaconda prompt命令窗口下是可以正常导入的,而在pycharm编译器中则会报错。
pip uninstall -y numpy
Pip uninstall -y setuptools
Pip install setuptools
Pip install numpy
问题2安装dlib,提示numpy版本错误。
解决办法2:
安装dlib时,会自动安装numpy,不会对之前版本进行覆盖,所以,要卸载一个numpy
问题3
ImportError: numpy.core.multiarray failed to import
Installing collected packages: numpy
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.y
安装收集的包:numpy
错误:pip 的依赖解析器当前不考虑所有已安装的包。 此行为是以下依赖冲突的根源。
解决办法:
Conda uninstall numpy
Pip uninstall numpy
Pip show numpy
一定要所有的numpy卸载干净了,再重新下载。
因为是在anaconda的虚拟环境下,所以有的是通过pip下载,有的是通过conda下载,所以软件可能会冲突。
重新安装后就好啦。