The solution to "module 'cv2.cv2' has no attribute 'face' and module 'cv2' has no attribute 'gapi_wip_gst_GStr.

 """
original author: jacky Li
Email : [email protected]
Last edited: 2022.11.8

"""

Boss detour, here is a vegetable dog

Table of contents

Boss detour, here is a vegetable dog

A "module 'cv2.cv2' has no attribute 'face' "solution

1. Install the solution

2. Reloading method

Second module 'cv2' has no attribute 'gapi_wip_gst_GStr solution


A "module 'cv2.cv2' has no attribute 'face' "solution

This kind of problem occurs because after the update of the new version of opencv-python, many extension files of opencv-python need to be downloaded separately, instead of just one download and installation as before, the solution is given here.

1. Install the solution

pip install opencv-python  //直接对cv库进行下载
pip install opencv-contrib-python // 对cv库的扩展文件进行下载

However, the download through this path will respond very slowly or even report an error such as timeout. The safflower is very dazzling, so we can use the domestic mirror to speed up the download. Douban source is recommended here.

pip install opencv-contrib-python -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
pip install opencv-python -i http://pypi.douban.com/simple --trusted-host pypi.douban.com

Enjoy blazing fast download speeds

2. Reloading method

Some friends responded, I downloaded it and it shows that I have downloaded it

In this case, I have all the libraries I want to download, but they still can’t run. This is really embarrassing for the blogger, but after many attempts, the blogger found that it only needs to be uninstalled and reinstalled . I don’t know why, but don’t dislike the blogger dish dog

pip uninstall opencv-contrib-python
pip uninstall opencv-python

 Use the above command to uninstall these two libraries, and then use the installation solution to re-download and use it

pip install opencv-contrib-python -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
pip install opencv-python -i http://pypi.douban.com/simple --trusted-host pypi.douban.com

Next, everyone can "swipe" the downloaded code at a fast speed and run it successfully ! ! !

Second module 'cv2' has no attribute 'gapi_wip_gst_GStr solution

This problem is usually caused by the incompatibility of many versions after cv2 is updated. What we need is to restore the immature version that cannot be used to the mature version that can be used before. This command is recommended here

pip install opencv-python install "opencv-python-headless<4.3"

The version will be replaced and the code will be ready to run.

If you feel that what the blogger said is useful to you, please click to support it, and will continue to update such issues...

Guess you like

Origin blog.csdn.net/weixin_62075168/article/details/127767849