【发布时间】:2019-10-16 21:26:52
【问题描述】:
我正在尝试运行以下代码来提取一些图像:
from google_images_download import google_images_download #importing the library
response = google_images_download.googleimagesdownload() #class instantiation
arguments = {"keywords":"foxes, shiba inu outside","limit":2000,"print_urls":True} #creating list of arguments
paths = response.download(arguments) #passing the arguments to the function
print(paths) #printing absolute paths of the downloaded images
因为我正在尝试制作 100 多张图片,所以我收到一条消息说
看起来我们无法找到“chromedriver”的路径(使用“--chromedriver”参数指定可执行文件的路径。)或您的计算机上未安装 google chrome 浏览器(例外:预期的 str、字节或os.PathLike 对象,不是 NoneType)
我不确定如何将 chromedriver 集成到我的代码中并设置路径。我四处寻找,但找不到明确的答案。我尝试添加该行
browser = webdriver.Chrome(executable_path=r"/Users/jerelnovick/Desktop/Projects/Image_Recognition/chromedriver.exe")
正如我在一篇文章中所读到的,但那给了我一条消息说
WebDriverException:消息:“Image_Recognitionchromedriver.exe”可执行文件需要在 PATH 中。请看https://sites.google.com/a/chromium.org/chromedriver/home
我使用的是 Mac。
【问题讨论】:
标签: python selenium selenium-chromedriver google-image-search