问题
I am using python 3.5.2, when am tryng to import the selenium it is throwing an error
No module named selenium
below is my code:
from selenium import webdriver
回答1:
You should install the selenium package first.
pip install selenium
回答2:
I installed selenium through
pip install selenium
like yan said, but I still received the same error. The problem in my case was that selenium was installed on a different drive than my project was on (i.e. project was on D:, selenium was on C:). Moving both to the C: drive fixed it for me.
回答3:
Step 1: Install Python bindings for Selenium
pip install selenium
Step 2: Install the browser drivers
Selenium requires a driver to interface with the chosen browser.
Firefox, for example, requires geckodriver, which needs to be installed.
- Get the executable from here (just download one from the last release)
- Move the executable to your PATH, e. g. ubuntu, place it in
/usr/bin
or/usr/local/bin
.
Note: Other supported browsers will have their own drivers available more info here
来源:https://stackoverflow.com/questions/46999613/how-to-install-selenium