ModuleNotFoundError: No module named ‘selenium’
What I tried: Added path to sysdm.cpl Ran multiple commands in terminal in VScode, like creating a venv and path changing.
Note:
Selenium is installed and can be found if I run pip –install selenium, yet it still throws an error when I run script in VScode
I have no clue how to run modules and want to start coding.
2
Answers
You have probably not installed
selenium
for the same python interpreter that is running your script. In your script, put these two lines at the very top:Then run this script like you normally would. This should print the path to the interpreter that is running your script, I’ll assume it is
/path/to/python
Now try running
in your terminal. This should install
selenium
specifically for the python version that sits at/path/to/python
This is most likely because multiple versions of python exist on your machine, and the environment where you successfully installed the
selenium
package is not the same python version as the environment you are using.Solution:
Python:Select Interpreter
What is the correct interpreter?
Select the python environment where the
selenium
package has been successfully installedSelect the python version you want to use, then create a new terminal to activate the environment, and finally install the
selenium
package for this environment in the new terminal