How to connect virtual environment to project directory?

19 views Asked by At

I am new to virtual environments and needed some help with a problem. I have created a virtual environment MyEnv using anaconda prompt. I can see the virtual environment in C:\Users\SP\anaconda3\envs. Next, I installed the python library selenium after activating MyEnv in anaconda prompt. I also created a python script file MyScript.py in D:\MyProject but on running the script, it gives the error ModuleNotFoundError: No module named 'selenium'.

I installed the library using the command conda install selenium after activating MyEnv in anaconda prompt. I checked the list of packages installed in my virtual environment MyEnv using the command conda list and I could see selenium in that list. I am using spyder IDE and I launch spyder from anaconda prompt using the following commands:

conda activate MyEnv

spyder

After spyder opens, I navigate to D:\MyProject to open MyScript.py file.

I would greatly appreciate any help in this direction.

0

There are 0 answers