VScode-problem solving: import cv2 or other libraries have no function prompt but run normally

Finally, the problem of python import XXX without function prompt is solved! ! ! ! ! ! ! !

Problem Description

After importing cv2, the program runs without problems, but when using cv2 functions, there is no function prompt. I was very distressed at one time, and writing programs relied on memory. . . . .

Insert picture description here

But fortunately, today I found inspiration in the blog of a brother with a problem with vscode on ubuntu, and finally found a solution!
If there is a problem with vscode under Linux+conda environment, move: Under Linux environment, VScode import cv2 or other libraries have no function prompt but run normally

Solution

step one

First, it will search in settings python: interpreter Path,
Insert picture description here

If yours is still python, please immediately change it to your python path, I am here D:\Python\Python3.70.
Insert picture description here

Ok, then restart vscode and try to enter the function to see if there is a prompt. If there is, then it is ok. If it is still not, then please continue to the second step.

Step two

There is one at the bottom of the setting page just now Extensions Path. If not, search for it, click edit in setting.json ,
Insert picture description here
find "python.autoComplete.extraPaths"this item, and complete the path of your expansion package. The specific folder is shown in the figure:
Insert picture description here
restart vscode! !

Perfect solution! !

Now the function prompt will appear after importing the library!
Insert picture description here

Guess you like

Origin blog.csdn.net/qq_45779334/article/details/112133964