mac添加Chromedriver

1.下载对应版本的驱动器

http://chromedriver.storage.googleapis.com/index.html

2.驱动器放在python的安装目录下

a.找到python的安装路径

终端输入which python,可以查出路径

Mac下/usr/local目录默认是对于Finder是隐藏,如果需要到/usr/local下去,打开Finder,然后使用command+shift+G,在弹出的目录中填写路径就可以了

b.把驱动器放在目录下

3.配置环境变量

打开终端

输入vi ./.bash_profile回车

输入i进入编辑模式

添加环境变量export PATH=$PATH:/usr/local/bin/chromedriver

点击“esc键,退出insert模式”, 然后输入“:wq!”,回车,保存成功

输入“source ./.bash_profile”,让环境变量生效

输入”echo $PATH”,查看环境变量,发现添加成功

4.赋予权限

sudo chmod u+x,o+x /usr/local/bin/chromedriver

参考文档:

https://www.cnblogs.com/sundaysgarden/p/10968764.html

https://blog.csdn.net/Rouckie/article/details/84555005

https://blog.csdn.net/qq_44846324/article/details/115458265

原文地址:https://www.cnblogs.com/sevenwind/p/14701254.html