簡體   English   中英

無法 conda 安裝 chromedriver

[英]can't conda install chromedriver

所以我正在做一個小項目,在那里我抓取雅虎新聞評論。

嘗試安裝 chromedriver 時出現錯誤。

我想知道我犯了一些錯誤,如果有人能告訴我,我將不勝感激。

(base) PS C:\Users\aaa> conda install chromedriver
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.

PackagesNotFoundError: The following packages are not available from current channels:

  - chromedriver

Current channels:

  - https://repo.anaconda.com/pkgs/main/win-64
  - https://repo.anaconda.com/pkgs/main/noarch
  - https://repo.anaconda.com/pkgs/r/win-64
  - https://repo.anaconda.com/pkgs/r/noarch
  - https://repo.anaconda.com/pkgs/msys2/win-64
  - https://repo.anaconda.com/pkgs/msys2/noarch

To search for alternate channels that may provide the conda package you're
looking for, navigate to

    https://anaconda.org

and use the search bar at the top of the page.

比我從 <sites.google.com/chromium.org/driver> 下載文件並打開 exe 文件時,顯示

Starting ChromeDriver 93.0.4577.63 (ff5c0da2ec0adeaed5550e6c7e98417dac77d98a-refs/branch-heads/4577@{#1135}) on port 9515
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.

當我運行代碼時

from selenium import webdriver
driver = webdriver.Chrome()

顯示錯誤:

WebDriverException: Message: unknown error: cannot find Chrome binary
  (Driver info: chromedriver=2.38.552522 (437e6fbedfa8762dec75e2c5b3ddb86763dc9dcb),platform=Windows NT 10.0.19043 x86_64)

我想知道是不是chrome版本太舊了。

我應該怎么辦?

我希望這能解決問題,但我在這里找到了這個命令

 conda install -c conda-forge python-chromedriver-binary

編輯:

chrome 驅動程序要求您指定 google chrome 和 chromedriver 路徑。

首先你需要從這里下載 chromedriver,然后在你的 python 代碼中添加如下路徑:

from selenium import webdriver

options = webdriver.ChromeOptions()
options.binary_location = r"<YOUR_CHROME_PATH>\chrome.exe"
chrome_driver_path = r"<PATH_TO_CHROME_DRIVER>\chromedriver.exe>"

browser = webdriver.Chrome(chrome_driver_path, options=options)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM