I am new to python. I am using VS code on Windows. Following is my simple python code.
from selenium import webdriver
browser = webdriver.Firefox()
browser.get('http://seleniumhq.org/')
I am trying to install selenium package but it is giving me error ModuleNotFoundError: No module named 'selenium'. I tried following commands.
conda install selenium
python -m pip install -U selenium
Then I tried in a virtual env
conda create -n selenium-env python=3.6
conda activate selenium-env
conda install -n selenium0env selenium
Still getting the same error. Update:
I noticed that when I first run the py file after restarting VS code, it activates one of my virtual environments automatically. I think that virtual env does not have selenium installed in it. Below is the terminal output when I run the py file
How do I stop that environment from getting activated automatically? I want to run this in a different environment.
PS D:\Learnings\Python\SampleDesktopApp> conda activate pyfinance
PS D:\Learnings\Python\SampleDesktopApp> &
C:/Users/rajen/anaconda3/envs/pyfinance/python.exe
d:/Learnings/Python/SampleDesktopApp/Test.py
Traceback (most recent call last):
File "d:\Learnings\Python\SampleDesktopApp\Test.py", line 1, in <module>
from selenium import webdriver
ModuleNotFoundError: No module named 'selenium'
PS D:\Learnings\Python\SampleDesktopApp>