新换了电脑,从新配置下环境,备忘下html
=============================================================== python
1.python2环境安装web
https://www.python.org/downloads/release/python-2714/chrome
下载64位Windows x86-64 MSI installer双击安装api
配置环境变量,将对应的目录添加pathgoogle
C:\Python27和C:\Python27\Scripts(pip的路径)url
验证cmd输入python 3d
2.selenium安装,使用pip安装htm
C:\Windows\system32>pip install seleniumblog
这样下载的是selenium3 “ Successfully installed selenium-3.141.0 urllib3-1.24.1”
验证
python环境import selenium
3.chromedriver安装
http://chromedriver.storage.googleapis.com/index.html,惋惜没有我要的64位driver啊
版本 70.0.3538.110(正式版本) (64 位)
下载个win32试试,
解压后将exe文件拷贝到chrome的目录下C:\......l\Google\Chrome\Application
将C:\......l\Google\Chrome\Application这个目录添加到环境变量path中
4验证环境
>>> from selenium import webdriver
>>> dr=webdriver.Chrome()
DevTools listening on ws://127.0.0.1:62805/devtools/browser/7c83c3a9-7fe7-43be-9fdc-02c824a59290
>>> dr.get('https://www.baidu.com/')
>>>
成功
=====================================================
python3环境安装
1.安装python3
下载双击安装目录选择d:/python3,配置环境变量,将D:\python3\Scripts添加道path中
2.使用pip安装seleni
cd D:\python3\Scripts
python3 -m pip install selenium
3.chromedriver
由于上个python2已经安装配置了driver,因此掠过这一步
4.验证是否成功