Solve the problem that Anaconda installs OpenCV-Python without automatic code completion in pycharm

At first
, in order to solve this problem, reading countless blogs can only be said to be fruitless. My opencv-python is installed in the virtual environment of anaconda.
I was happy to import cv2, but there is a problem with the cv2 code prompt below. There is no code prompt? ! This is just the beginning, so you can't rely on muscle memory to type code T_T

At the beginning, I honestly tried the methods of other bloggers one by one. At first, I thought it was a problem with the opencv version, and later I modified the numpy version to no avail.
Later I used import cv2.cv2 as cvcode similar to this, also didn't solve the problem

Now let me talk about the solution to my situation. Under the guidance of my classmates, I found cv2.pyd'the file in the folder cv2 in anaconda
insert image description here
and moved it to the upper level site-packagesfolder.
insert image description here
Then pycharm can realize the intelligent perception
insert image description here
. Finally, Hope this article can help you! ! !

Guess you like

Origin blog.csdn.net/weixin_64632836/article/details/128377143