Python包selenium的geckodrive错误处理
作者:互联网
selenium运行下面语句,会报错误,错误信息为:Message: ‘geckodriver’ executable needs to be in PATH.
from selenium import webdriver
driver = webdriver.Firefox()
Mac电脑的话,首先安装homebrew包管理器,打开官网:https://brew.sh/,终端运行下面语句,可能需要fq
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
如果不行的话,运行下面的代码试试,按步骤操作即可,我自己成功了。
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
安装好了homebrew,运行一下代码安装geckodriver就可以了。
brew install geckodriver
重新运行一下,我用得是jupyter notebook,需要重新启动一下服务才可以。
from selenium import webdriver
driver = webdriver.Firefox()
标签:webdriver,install,Python,selenium,geckodrive,sh,https,geckodriver,错误处理 来源: https://blog.csdn.net/jianai858/article/details/118442637