默认打开cmd,无法执行pip install selenium,报错:‘pip‘ 不是内部或外部命令,也不是可运行的程序或批处理文件。
所以cd到python script的根目录,cd C:UsersAdministratorAppDataLocalProgramsPythonPython37-32Scripts
然后在运行pip install selenium
报错:waston-developer-cloud 2.6.0 has requirement websocket-client==0.48.0, but you'll have websocket -client 0.57.0 which is incoopatibale.
只能手动安装了。
参考这篇博客:https://www.cnblogs.com/xiaxiaoxu/p/8909622.html
chromedriver的安装这里略。
然后,python测试一下chromedriver的安装。
import time from selenium import webdriver driver = webdriver.Chrome('C:/Program Files (x86)/Google/Chrome/Application/chromedriver') # Optional argument, if not specified will search path. driver.get('http://www.google.com/'); time.sleep(5) # Let the user actually see something! driver.maximize_window() search_box = driver.find_element_by_name('q') search_box.send_keys('ChromeDriver') search_box.submit() time.sleep(5) # Let the user actually see something! driver.quit()
测试成功。
ref:https://sites.google.com/a/chromium.org/chromedriver/getting-started