How do I configure OpenCV in Visual Studio Code?

I have my code in google colab with OpenCV used. I want to execute my code in VS code but OpenCV isn’t there how can I do, may someone help me ? I saw some tutos with c++ environment but I want resources with python. Thanks

  1. Install anaconda.
  2. Create virtual environment and install OpenCV.
  3. Install VSCode.
  4. Activate virtual environment from the anaconda console.
  5. type code to open VSCode.
    Write me a reply if you get stuck.
    Good luck.

Thank you for reply. I’m doing what you advised I’ll come back to you.

1 Like

Yonathan, this is what I did:

  1. Installe anaconda.
  2. Create virtual environment and install OpenCV.
  3. Install VSCode.
    But,
    activating virtual environment from the anaconda console doesn’t work I don’t know if you can have an idea ?

Check out this tutorial by Microsoft.

Please clarify what you mean by

“activating virtual environment from the anaconda console doesn’t work”

You just do conda activate name-of-env then type code to open VSCode.

After VSCode has opened, type Ctrl+Shift+P and type python to get to all menu options starting with python. Choose the Python: Select Interpreter and select interpreter which is the conda environment with OpenCV.
From my experience you should restart VSCode (from the conda env as before).
Tell me if this worked for you.