簡體   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