Selenium works in Terminal but not the Python Shell

  • I am running python on a Mac (10.15.6). When I run this script from the terminal, it works fine

    from selenium import webdriver

    But starting it from the Python IDLE or VSCode, I get the message:

    ModuleNotFoundError: No module named 'selenium'

    I have no clue why it works from the terminal and not from the shell. It would be great if someone could help me out or point me in a direction where I might find the answer 🙂

  • It's seems like the Python interpreter you're using in the shell is not the same one used by Vscode. You can change the Python environment to match the one you're using in your Shell, or even install selenium in the Python interpreter currently used with:

    python -m pip install -U selenium

Suggested Topics