python2/3+selenium+chrome driver 64位环境配置

新换了电脑,重新配置下环境,备忘下

=============================================================== 

1.python2环境安装

https://www.python.org/downloads/release/python-2714/

下载64位Windows x86-64 MSI installer双击安装

配置环境变量,将对应的目录添加path

C:Python27和C:Python27Scripts(pip的路径)

验证cmd输入python 

2.selenium安装,使用pip安装

 C:Windowssystem32>pip install selenium

这样下载的是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:......lGoogleChromeApplication

将C:......lGoogleChromeApplication这个目录添加到环境变量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:python3Scripts添加道path中

2.使用pip安装seleni

cd D:python3Scripts

python3 -m pip install selenium

 3.chromedriver

因为上个python2已经安装配置了driver,所以掠过这一步

4.验证是否成功

原文地址:https://www.cnblogs.com/xueli/p/10019119.html