Installation of OpenCV in anaconda not showing up in VS Code in Windows 10

Viewed 1947

I have a VM running only Anaconda. There are no other available installations of Python. This is all I see when I run "Apps and Features" in Windows 10 and filter for Python (note that it is Python 3.7.4):

enter image description here

When I go to the Conda prompt and enter conda list, I see that I have openCV installed :

enter image description here

but it's with a version of Python 3.7.6:

enter image description here

However when I open VS Code and I set my Python Path to the version in the Anaconda folder: (C:\Users\Me\Anaconda3\Python.exe) and try to import OpenCV, I get the "module not found" error. When I create a new python file and run

help("modules")

I do not see OpenCV in the list below in the terminal even though its installed.

Any idea how this is happening? I just don't see a second installation of Python on my PC, but why am I seeing 3.7.4 and 3.7.6 and is this possibly causing my issue?

Edit: Added a picture of the error I get when trying to run it.

enter image description here

1 Answers

Install anaconda plugin in VSCode and select your conda environment in the bottom left of VSCode window.

If you didn't create a conda environment, the you will probably have installed the package in the base environment.

Edit: Reading the PyPi project, I found the right way to import opencv in python code.

import cv2
Related