1.安装brew brew.sh
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
复制到终端运行,brew是个非常好用的安装软件的工具,这个得科学上网才能安装,也可以采用镜像安装
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
使用中科院那个
2.安装selenium
python3 -m pip3 install selenium
如果报这个错误
ERROR: Could not build wheels for cryptography which use PEP 517 and cannot be installed directly
WARNING: You are using pip version 20.2.3; however, version 22.0.3 is available.
You should consider upgrading via the '/Library/Developer/CommandLineTools/usr/bin/python3 -m pip install --upgrade pip' command.
说明pip版本不匹配,python3.6以上版本自带pip3,老版本需要自己安装,按照上面提示,终端运行
python3 -m pip install --upgrade pip
然后在执行一遍
python3 -m pip install selenium
3.安装chromedriver 这时就用上了第一步安装的brew 终端输入
brew install --cask chromedriver
会根据你的chrome版本自动安装对应的chromedriver
测试安装成功