cv2.imshow()安装easyocr时不起作用
我使用pip
install easyocr 在新创建的Python环境中安装了easyocr
。 然后我安装了opencv-python
。
当我尝试执行代码时 -
import cv2
img = cv2.imread('2.jpg')
cv2.imshow('sd',img)
cv2.waitKey(0)
这是错误的错误
openCV(4.5.5)d:\ a \ opencv-python \ opencv-python \ opencv \ imules \ highgui \ src \ src \ window.cpp:1268:error:( - 2:未指定的错误)未实现该功能。 。用Windows,GTK+ 2.X或可可支持重建库。如果您在ubuntu或debian上,请安装libgtk2.0-dev和pkg-config,然后重新运行cmake或在函数中配置脚本'cvshowimage'
I installed easyocr
in a newly created python environment using pip
install easyocr
.
Then i installed opencv-python
.
when i try to execute the code -
import cv2
img = cv2.imread('2.jpg')
cv2.imshow('sd',img)
cv2.waitKey(0)
It's giving error
OpenCV(4.5.5) D:\a\opencv-python\opencv-python\opencv\modules\highgui\src\window.cpp:1268: error: (-2:Unspecified error) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Cocoa support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function 'cvShowImage'
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题:
如果您已经在系统/环境中拥有现有
OpenCV
版本;安装easyocr
可以更改它。通过sumplliences.txt file.txt file
easyocr
,opencv-python-headless
被安装。以下摘录摘自
opencv-python-headless
document> document> document ::tldr;
简而言之,
easyocr
禁用现有的GUI功能。它是专门针对容器化的应用程序和/或服务器部署而设计的。解决方案:
要使用
easyocr
使用opencv
,您可以尝试以下任一项:1。更改安装顺序:
可以使用
pip
:首先安装EasyOROCR
进行所有以下操作OpenCV-Python-Headless
。opencv-python
2。使用
matplotlib
仍然可以使用
matplotlib
:Problem:
If you already have an existing
OpenCV
version in your system/environment; installingeasyOCR
can alter that. Going through therequirements.txt file
ofeasyOCR
,opencv-python-headless
gets installed.The following excerpt is taken from
opencv-python-headless
documentation:TLDR;
In short,
easyocr
disables existing GUI capabilities. It has been designed exclusively for containerized applications and/or server deployments.Solution:
To use
easyOCR
withOpenCV
, you can try either one of the following:1. Change installation sequence:
All the following can be done using
pip
:easyocr
.opencv-python-headless
.opencv-python
2. Use
matplotlib
One can still display images using
matplotlib
: