1.安装环境
opencv 下载
pip install opencv-python==4.7.0.72
pip install openvino==2023.0.0
pytorch 模型下载(https://pytorch.org/get-started/previous-versions/)
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
onnxruntime 模型下载
pip install onnxruntime-gpu==1.15
2.验证环境
import cv2 as c
import torch as t
print(t.__version__)
print(c.__version__)
3.遇到的问题
问题描述:
A module that was compiled using NumPy 1.x cannot be run in NumPy 2.0.2 as it may crash. To support both 1.x and 2.x versions of NumPy, modules must be compiled with NumPy 2.0. Some module may need to rebuild instead e.g. with 'pybind11>=2.12'. If you are a user of the module, the easiest solution will be to downgrade to 'numpy<2' or try to upgrade the affected module. We expect that some modules will need time to support NumPy 2.
这是python 库numpy2.x和opencv的不兼容(不要下载最新版本!!)
解决方案:
pip uninstall -y numpy
pip uninstall -y setuptools
pip install setuptools
pip install numpy==1.23.5