Reputation: 1466
I am running into trouble running a python program inside visual studio code on my Windows 10 PC.
When I start a python session from the terminal and say import cv2
I get no errors:
When I go through the command prompt and start VSCode
from within the env, I get the ModuleNotFoundError
Traceback (most recent call last):
File "gui.py", line 3, in <module>
import cv2
ModuleNotFoundError: No module named 'cv2'
When I try to run the program as python gui.py
from within the environment my command prompt crashes with the error message:
I'm not sure how to ask this question other than wondering is there a way to start my IDE from within the python env so that it can locate all the local packages.
Upvotes: 10
Views: 42769
Reputation: 11
Upvotes: 1
Reputation: 969
Make sure your environment variables are configured. (see below image for reference)
Go to your Anaconda command prompt, and type code --version
(see below image for reference)
To Launch VS code from Anaconda/Window command prompt type code
. (see below image)
Upvotes: 21