如何做盆栽蔬菜网站,非主流在线制作图片,建设网站的程序,乐从网站制作解决#xff1a;ModuleNotFoundError: No module named ‘selenium’ 文章目录 解决#xff1a;ModuleNotFoundError: No module named selenium背景报错问题报错翻译报错位置代码报错原因解决方法方法一#xff0c;直接安装方法二#xff0c;手动下载安装方法三#xff0…
解决ModuleNotFoundError: No module named ‘selenium’ 文章目录 解决ModuleNotFoundError: No module named selenium背景报错问题报错翻译报错位置代码报错原因解决方法方法一直接安装方法二手动下载安装方法三编译安装 Selenium 简介今天的分享就到此结束了 背景 在使用之前的代码时报错 Traceback (most recent call last): File “xxx”, line xx, in import selenium ModuleNotFoundError: No module named ‘selenium’ 报错问题
Traceback (most recent call last): File xxx, line xx, in import selenium ModuleNotFoundError: No module named selenium 报错翻译
主要报错信息内容翻译如下所示
Traceback (most recent call last): File xxx, line xx, in import selenium ModuleNotFoundError: No module named selenium
翻译
追溯最近一次通话 文件“xxx”第xx行在 导入selenium ModuleNotFoundError:没有名为“selenium”的模块 报错位置代码 ...import selenium
... 报错原因
经过查阅资料发现这个错误通常是由于缺少selenium的依赖库就会出现这样的提示。
小伙伴们按下面的解决方法即可解决 解决方法
要解决这个错误需要安装selenium的依赖库即可解决。
方法一直接安装
在window下安装selenium
pip install selenium如果你嫌下载慢可以更改下载源
比如利用豆瓣的下载源
pip install selenium -i http://pypi.douban.com/simple --trusted-host pypi.douban.com附国内各大源列表
名称地址阿里https://mirrors.aliyun.com/pypi/simple豆瓣http://pypi.douban.com/simple/清华大学https://pypi.tuna.tsinghua.edu.cn/simple中国科学技术大学https://pypi.mirrors.ustc.edu.cn/simple华中理工大学http://pypi.hustunique.com/simple山东理工大学http://pypi.sdutlinux.org/simple网易https://mirrors.163.com/pypi/simple/腾讯https://mirrors.cloud.tencent.com/pypi/simple
如果你使用的是conda环境请尝试使用conda install安装selenium。
如果你使用的是pip安装selenium可以尝试使用以下命令安装
pip install --no-cache-dir selenium方法二手动下载安装
将安装包手动下载到本地进行安装然后在cmd 中进入安装包的路径下面用cd 路径进入。
然后输入以下命令
pip install selenium-4.17.2-py3-none-any.whl
就可以进行安装了。
附下载链接点击下载对应版本的dilb链接 https://pypi.org/project/selenium/#description
方法三编译安装
如果上述方法都不能解决问题你可以尝试从源代码编译安装selenium。具体步骤可以参考selenium的官方文档。
Selenium 简介
Selenium 通过使用 WebDriver 支持市场上所有主流浏览器的自动化。 Webdriver 是一个 API 和协议它定义了一个语言中立的接口用于控制 web 浏览器的行为。 每个浏览器都有一个特定的 WebDriver 实现称为驱动程序。 驱动程序是负责委派给浏览器的组件并处理与 Selenium 和浏览器之间的通信。
这种分离是有意识地努力让浏览器供应商为其浏览器的实现负责的一部分。 Selenium 在可能的情况下使用这些第三方驱动程序 但是在这些驱动程序不存在的情况下它也提供了由项目自己维护的驱动程序。
Selenium 框架通过一个面向用户的界面将所有这些部分连接在一起 该界面允许透明地使用不同的浏览器后端 从而实现跨浏览器和跨平台自动化。
Selenium setup is quite different from the setup of other commercial tools. Before you can start writing Selenium code, you have to install the language bindings libraries for your language of choice, the browser you want to use, and the driver for that browser.
Follow the links below to get up and going with Selenium WebDriver.
If you wish to start with a low-code/record and playback tool, please check Selenium IDE
Once you get things working, if you want to scale up your tests, check out the Selenium Grid.
官方下载地址https://www.selenium.dev/ 官方piphttps://pypi.org/search/?qselenium 今天的分享就到此结束了 欢迎点赞评论关注三连