I have a workspace folder, with a virtual environment under /venv/ I have an older version of opencv-python installed here (3.4.6.27) than what I have globally (4.4.0.46). However, despite pointing visual studio code to my venv, inspecting the version shows the higher one.
I.e., When I activate the venv in a terminal, then
pip list
I get this
Package Version
------------- --------
numpy 1.19.4
opencv-python 3.4.6.27
pip 20.1.1
setuptools 47.1.0
But in a visual studio notebook:
import pkg_resources
pkg_resources.get_distribution("opencv-python").version
provides
'4.4.0.46'
When I click to select to the interpreter, it is pointing to the correct path.
Current: ~/Desktop/workspace/venv/bin/python
So what am I missing?
It is possible for a Jupyter notebook in VS Code to use a different interpreter than the VS Code interpreter setting. Check the Python kernel by clicking the kernel name up on the top right of the window (Look for "Python 3: Idle" or similar). Click that and make sure it is pointing at the right Python executable.