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

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

嗨,我是 python 的新开发者 我想使用 selenium 网络驱动程序 api 并使用 mac 电脑和我安装网络驱动程序库

i 安装代码 'pip install web driver' 在 pycharm 项目解释器但错误

错误定义如下:

  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 :(

未找到网络驱动程序的匹配分布

你能帮帮我吗

祝福...

这不是很清楚地记录下来,但是你不能从 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("

你可以试试下面的方法,如果你不知道路径,使用!apt install chromium-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)

我在 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

这对我有用

sudo python3 -m pip install selenium

并且安装完selenium之后,就可以安装web driver manager

sudo python3 -m pip install webdriver_manager