opencv使用pyinstaller打包错误:‘can‘t find starting number (in the name of file)

使用Python语言和opencv模块在pycharm中编辑的代码运行没问题,但是在使用pyinstaller打包后出现错误'can‘t find starting number (in the name of file)

[ERROR:0] global C:\Users\runneradmin\AppData\Local\Temp\pip-req-build-q3d_8t8e\opencv\modules\videoio\src\cap.cpp (162) cv::VideoCapture::open VIDEOIO(CV_IMAGES): raised OpenCV exception:

OpenCV(4.5.3) C:\Users\runneradmin\AppData\Local\Temp\pip-req-build-q3d_8t8e\opencv\modules\videoio\src\cap_images.cpp:253: error: (-5:Bad argument) CAP_IMAGES: can't find starting number (in the name of file): rtsp://admin:[email protected]/h264/ch2/main/av_stream in function 'cv::icvExtractPattern'

原因是打包的文件中缺少了缺少对应型号的ffmpeg,如opencv_videoio_ffmpeg430_64.dll。

找打环境中安装cv2时的文件夹“D:\Program Files\XXX\envs\Lib\site-packages\cv2”,将opencv_videoio_ffmpeg4XX_64.dll复制到打包好的exe所在的文件夹中,问题解决。

你可能感兴趣的:(OpenCV,opencv,webpack,javascript)