ModuleNotFoundError:没有名为"selenium"的模块 [英] ModuleNotFoundError: No module named 'selenium'
问题描述
运行此Selenium脚本时出现错误.请提出可以解决此问题的方法: 脚本:
I get an error while running this selenium script. Please suggest what can be done to fix this: Script:
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import re
import csv
import time
driver = webdriver.chrome("<webdriver path>")
driver.get("https://www.google.com/")
driver.find_element_by_xpath('//*[@title="Search"]')
send_keys('abc')
driver.find_element_by_xpath('//*[@class="sbico _wtf _Qtf"]').click()
time.sleep(5)
driver.find_element_by_xpath('//[@id="rso"]/div[1]/div/div[1]/div/div/h3/a')
print(var)
错误:
回溯(最近通话最近): 文件"C:/Users/admin/Desktop/test2.py",第2行,在 从硒导入webdriver ModuleNotFoundError:没有名为"selenium"的模块
Traceback (most recent call last): File "C:/Users/admin/Desktop/test2.py", line 2, in from selenium import webdriver ModuleNotFoundError: No module named 'selenium'
我已经在Win 7 Professional 32位上安装了Python 3.6.我有Selenium Standalone Server版本3.4.0(链接)
I have installed Python 3.6 on win 7 Professional 32 bit. I have Selenium Standalone Server version 3.4.0(link)
推荐答案
尝试使用pip安装硒.使用以下命令.
Try installing selenium using pip. Use the following command.
python -m pip install -U selenium
这篇关于ModuleNotFoundError:没有名为"selenium"的模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!