繁体   English   中英

错误:找不到满足 webdriver 要求的版本(来自版本:)

[英]Error : Could not find a version that satisfies the requirement webdriver (from versions: )

嗨,我是 Python 的新开发人员,我想使用 selenium Web 驱动程序 API 并使用 mac pc 并且我安装 Web 驱动程序库

我在 pycharm 项目解释器上安装代码“pip install web driver”但错误

错误定义如下:

 Try to run this command from the system terminal. Make sure that you use the correct version of 'pip' installed for your Python interpreter located at '/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/bin/python3.5'. Could not find a version that satisfies the requirement webdriver (from versions: ) No matching distribution found for web driver

注意:我使用 python 3.5 但终端使用 2.7 :(

找不到与 Web 驱动程序匹配的发行版

你能帮我吗

最好的祝愿...

这不是很清楚地记录在案,但是您不能从 pypi 安装 webdriver,但需要安装 selenium,然后它会为您提供 webdriver。

sudo pip install selenium

应该做的伎俩。 或者对于现代python:

sudo python3 -m pip install selenium

您还需要安装 geckodriver(适用于 Firefox)或 chromedriver(适用于 Chrome 和 Chromium)并将其放在您的路径中,以便能够实例化 webdriver 对象。

之后,像下面这样的事情应该可以工作:

from selenium import webdriver
driver = webdriver.Firefox()
driver.get("https://stackoverflow.com/questions/34256762/error-could-not-find-a-version-that-satisfies-the-requirement-webdriver-from")

您可以尝试以下方式,如果您不知道路径,请使用 !apt installchromium-chromedriver

!pip install selenium
!pip install webdriver-manager
!apt-get update # to update ubuntu to correctly run apt install
!apt install chromium-chromedriver

from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
import requests

from selenium import webdriver
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--headless')
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--disable-dev-shm-usage')
wd = webdriver.Chrome('chromedriver',chrome_options=chrome_options)
driver =webdriver.Chrome('chromedriver',chrome_options=chrome_options)
sudo python3 -m pip install selenium 

还是报错:

收集硒找不到满足硒要求的版本(来自版本:)找不到硒的匹配发行版

我安装了 Python2.7 和 3.5

我在 Ubuntu 上遇到了类似的问题。 我想安装特定的 Selenium 版本,但我不确定确切的标签,因为 Dockerhub 上的标签略有不同。 所以我的步骤是:

1 转到https://pypi.org/project/selenium/#files

2 单击Release history选项卡在此处输入图片说明

3 找到我需要的特定版本。 就我而言,它是 4.0.0.a7

4 从 Linux 终端执行:

pip install selenium==4.0.0.a7

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM