文章目录
一:修改安装源
1:打开Python Packages。
2:点击梅花按钮。
3:在弹出的对话框中,填入Name(随便填),Repository URL,选择下列的源,一般先选择清华源
国内源列表(一般是清华源比较好)
阿里云:http://mirrors.aliyun.com/pypi/simple/
豆瓣:http://pypi.douban.com/simple/
清华大学:https://pypi.tuna.tsinghua.edu.cn/simple/
中国科学技术大学:https://pypi.mirrors.ustc.edu.cn/simple/
本来的源:https://pypi.org/simple
4:按OK确认。
5:配置完成
二:安装selenium
1:File→Settings→Project:STEST1→Python Interperter→点“+”→在新框中输入selenium。
2:在下面搜索出来的一些列结果中,选择selenium,注意,可能有多个selenium,选择你想要的URL路径,这里我们选择的是清华源的路径,看图示。
3:按Install Package,慢慢等待安装成功。
2.1:安装浏览器驱动:[基于谷歌Chrome]
2.1.1:安装Chrome浏览器。https://www.google.cn/chrome/index.html,去官网下载最新版本。
按照一下步骤查看版本号
2.1.2:下载对应的驱动
网址:https://googlechromelabs.github.io/chrome-for-testing/。
选择与版本号最接近的驱动下载。
复制下载链接到浏览器上触发下载
https://storage.googleapis.com/chrome-for-testing-public/130.0.6723.58/win64/chrome-headless-shell-win64.zip
2.1.3:进入下载文件夹,根据自己的需要下载对应版本的驱动。
解压下载的文件。
将chromedriver.exe拷贝至Chrome所在文件夹:C:\Program Files\Google\Chrome\Application。注意:可能在Program Files(X86)文件夹。
设置环境变量
在系统搜索框中输入“环境变量”,打开编辑系统环境变量界面,按照以下步骤,在系统环境变量的Path项目里添加chromedriver.exe所在目录。
拷贝到文件目录上方:C:\Program Files\Google\Chrome\Application
将下载的文件拷贝: