Python 2.7 PythonOpenCV:Python2.7和Python3.5之间的视频捕获差异
我通过ssh连接到远程系统,并尝试使用Python中的OpenCV VideoCapture读取帧。同样的代码在使用Python 2.7时成功,在使用Python 3.5时失败:Python 2.7 PythonOpenCV:Python2.7和Python3.5之间的视频捕获差异,python-2.7,opencv,python-3.5,Python 2.7,Opencv,Python 3.5,我通过ssh连接到远程系统,并尝试使用Python中的OpenCV VideoCapture读取帧。同样的代码在使用Python 2.7时成功,在使用Python 3.5时失败: import cv2 cap = cv2.VideoCapture(0) 蟒蛇2.7: print cap.isOpened() # prints True, further read() calls also return True 蟒蛇3.5: print (cap.isOpened()) # prints F
import cv2
cap = cv2.VideoCapture(0)
蟒蛇2.7:
print cap.isOpened() # prints True, further read() calls also return True
蟒蛇3.5:
print (cap.isOpened()) # prints False, and so are cap.open(), and of course cap.read().
是什么导致了这种行为
谢谢 我也有同样的问题。OpenCV是从源代码安装的。 Python2和3环境之间的区别在于,对于Python3,opencv Python是通过pip3额外安装的。A
pip3 uninstall opencv-python
在我的例子中解决了这个问题。每一个Python版本都有自己的openCV二进制文件副本,也许这两个版本是用不同的选项构建的?这正是我的问题。谢谢