Solve pycharm+opencv no automatic code completion

1. Development environment

os:win11

python:3.11.2

pycharm:2022.3.2 (Professional Edition)

opencv:4.7.0.68

2. Problem description

When writing opencv-related code, I suddenly found that there is no automatic code completion prompt, only a few most basic completion functions.

3. Solutions

Add an interpreter, and the pro-test is effective.

  1. File -> Settings ->

  1. Project: pythonProject->Python Interpreter->Show All->

  1. Python interpreter -> show interpreter path ->

  1. Interpreter Path -> Add ->

  1. select path ->

Note: Find your corresponding project path (pythonProject path in pycharm), find the "cv2" folder in the project path, select it and confirm.

  1. interpreter path ->

After confirming that there is a "User Added" item, click OK.

  1. Python interpreter ->

Click Apply and wait for the loading progress to complete.

  1. Python interpreter ->

Click OK when the loading progress is complete.

  1. Project: pythonProject->Python Interpreter->Settings->

Click "Confirm".

4. Test

Write a code test and find that the familiar code completion prompt is back.

Note: The newly created project needs to repeat the above operation!

Guess you like

Origin blog.csdn.net/weixin_45892910/article/details/129146875