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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/34256762/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 14:42:28  来源:igfitidea点击:

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

pythonmacosselenium

提问by RAMAZAN CESUR

hi i new developer at python i want to use selenium web driver api and use mac pc and i installation web driver library

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

i installation code 'pip install web driver' at pycharm project interpreter but error

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

Error definition look this:

错误定义如下:

  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

Note: i use python 3.5 but terminal use 2.7 :(

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

No matching distribution found for web driver

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

Could your help me please

你能帮我吗

Best wishes...

最好的祝愿...

采纳答案by Hubert

This is not very clearly documented, but you cannot install webdriver from pypi but need to install selenium, which then gives you webdriver.

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

sudo pip install selenium

should do the trick. After that things like the below should work:

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

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")

回答by Shaina Raza

you may try the following way, if you do not know the path, use !apt install chromium-chromedriver

您可以尝试以下方式,如果您不知道路径,请使用 !apt installchrome-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)