所以我正在做一个小项目,我收集雅虎的新闻评论。
当我尝试安装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.然后,当我从下载文件并打开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版本太旧了。
我该怎么办?
发布于 2021-09-17 04:07:46
我希望这能解决问题,但是我发现这个命令是here
conda install -c conda-forge python-chromedriver-binary**编辑**
chrome驱动程序要求您指定google chrome和chromedriver路径
首先需要从here下载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)https://stackoverflow.com/questions/69217566
复制相似问题