有关配置默认python3,请查看:https://blog.csdn.net/qq_35098526/article/details/103503578
pip install selenium
如果此过程安装失败:https://jingyan.baidu.com/article/f54ae2fc42f6021e92b84992.html 请自行下载安装包安装。
根据自己chrome浏览器的版本下载对应的, 我的环境如下:
从下载列表中我没有找到我对应的 78.0.3904.108版本,我选择78.0.3904.105版本下载
解压上个步骤下载的安装包,出现一个chromedriver文件,下来进行下面步骤:
sudo cp -R chromedriver /usr/local/bin/
编写下面文件test.py
from selenium import webdriver
browser = webdriver.Chrome()
browser.get("http://www.baidu.com")
print(browser.page_source)
browser.close()
运行: test.py
如果自动打开www.baidu.com网页,并自动关闭,则说明安装成功