简体   繁体   中英

No module named 'selenium' (Python3)

I'm trying to import selenium from a python3 application. I've already installed it asi you can see in the first image.

I also configured the vs code with python3 (image 2).

Both if i try to run it from vs code console or with python3 it says the same error.

Exception has occurred: ModuleNotFoundError No module named 'selenium' File "/Users/admin/Documents/Bot/bot.py", line 1, in from selenium import webdriver

I've tried several answers from StackOverflow but it didn't seem to work with me.

Note: i'm not using a virtual environment.

1

2

Since apparently i have a lot of python3 installed on my system i just created a virtual environment.

go to your program folder and type:

python3 -m venv virtual-env this will create a copy of python3 inside your program folder (in /virtual-env/bin/)

then you need to activate it:

source /virtual-env/bin/activate this will activate your virtual environment, so you can use your own copy of python3 located on your folder.

Once activated, your console will look like this:

(virtual-env) user:program admin$

thanks to everyone and sorry for the lateness

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM