Mac 通过brew安装selenium和chromedriver

16 篇文章 0 订阅
11 篇文章 2 订阅

1,安装selenium

pip3 install selenium

使用dirver = webdriver.Chrome()时会报错:

WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home

2.安装chromedriver:
brew install chromedriver
可能会卡在Updating Homebrew...,ctrl+c

多试几次哦!

brew 升级好了后!

报: Error: No available formula with the name "chromedriver"
Found a cask named "chromedriver" instead.

现在用下面命令重装chromedriver

brew cask install chromedriver

==> Verifying SHA-256 checksum for Cask 'chromedriver'.
==> Installing Cask chromedriver
==> Linking Binary 'chromedriver' to '/usr/local/bin/chromedriver'.     # 成功解决之前的报错(needs to be in PATH)
?  chromedriver was successfully installed!

 

In [1]: from selenium import webdriver

In [2]: dirver = webdriver.Chrome()

In [3]:

这样就成功了!!!  Mac 给力  brew 也很给力!!!!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值