[英]AttributeError: module 'cv2.cv2' has no attribute 'TrackerCSRT_create'
AttributeError: module 'cv2.cv2' has no attribute 'TrackerCSRT_create' is thrown. AttributeError: module 'cv2.cv2' has no attribute 'TrackerCSRT_create' 被抛出。
python version: 4.1.1 python 版本:4.1.1
opencv version: 4.1.1 opencv 版本:4.1.1
OS: Linux操作系统:Linux
# init
tracker = cv2.TrackerCSRT_create()
success = tracker.init(image, (xmin, ymin, xmax - xmin, ymax - ymin))
The code was working fine till last week.该代码在上周之前运行良好。 I tried to edit my code to create flask app, and encountered this problem upon calling the flask app.我试图编辑我的代码来创建 flask 应用程序,并在调用 flask 应用程序时遇到了这个问题。
update opencv-python and opencv-contrib-python to the latest version via pip3.通过 pip3 将 opencv-python 和 opencv-contrib-python 更新到最新版本。 To note that in my case, both packages were required to resolve the issue.请注意,在我的情况下,两个软件包都需要解决问题。
As per the docs please use:根据文档,请使用:
pip install opencv-contrib-python pip 安装 opencv-contrib-python
"Option 2 - Full package (contains both main modules and contrib/extra modules): pip install opencv-contrib-python (check contrib/extra modules listing from OpenCV documentation)" “选项 2 - 完整的 package(包含主模块和贡献/额外模块):pip 安装 opencv-contrib-python(检查来自 Z5BD4C87976F48E140255E919D 的贡献/额外模块列表)”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.