一、安装selenium
问题:提示未找到pip
MacBook-Air ~ % pip install selenium
zsh: command not found: pip
解决方案:
sudo easy_install pip

image.png
安装selenium(sudo pip uninstall selenium 卸载selenium)

image.png
运行python解释器,执行import selenium,无异常表示安装成功

image.png
二、安装Chrome浏览器驱动chromedriver
1、查看已安装谷歌版本:

image.png

image.png
2、下载chromderiver
下载地址:https://npm.taobao.org/mirrors/chromedriver/81.0.4044.69/或http://chromedriver.storage.googleapis.com/index.html

image.png

image.png
3、解压

image.png
4、进入/usr/local/bin

image.png

image.png
5、将chromderiver移到进入/usr/local/bin目录下

image.png

image.png

image.png
6、终端输入chromedriver --version检查版本

image.png
三、设置环境变量
打开终端,输入:touch .bash_profile 创建 .bash_profile文档,已有直接输入:open .bash_profile 打开

image.png

image.png
保存退出,之后在终端输入source .bash_profile 更新文档