pip3 install selenium
image.png
运行报错:
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home
安装chromedriver:
brew install chromedriver
可能会卡在Updating Homebrew...,ctrl+c
image.png
或者切换Homebrew默认源,附上替换及重置命令行:
替换brew.git:
cd "$(brew --repo)"
git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
替换homebrew-core.git:
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
重置brew.git:
cd "$(brew --repo)"
git remote set-url origin https://github.com/Homebrew/brew.git
重置homebrew-core.git:
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://github.com/Homebrew/homebrew-core.git
brew install chromedriver可能会提示xcode版本过低(其实并不低)
image.png
需要升级Homebrew:
brew update-reset
如果碰到报错:Error: No available formula with the name "chromedriver"
image.png
按他的提示执行:brew cask install chromedriver
image.png
网友评论