【发布时间】:2021-03-18 16:36:56
【问题描述】:
我第一次尝试创建网络爬虫。该脚本不会在没有错误代码的情况下运行。
我正在使用的教程:
https://oxylabs.io/blog/python-web-scraping
我已完成所有步骤,并通过其他 youtube 教程进行了进一步的步骤,但没有任何效果;(
错误代码:
Traceback (most recent call last):
File "C:\Users\hpy03\PycharmProjects\webtest\lib\site-packages\selenium\webdriver\common\service.py", line 72, in start
self.process = subprocess.Popen(cmd, env=self.env,
File "C:\Users\hpy03\AppData\Local\Programs\Python\Python38\lib\subprocess.py", line 854, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Users\hpy03\AppData\Local\Programs\Python\Python38\lib\subprocess.py", line 1307, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:/Users/hpy03/PycharmProjects/webtest/test_scraping.py", line 5, in <module>
driver = webdriver.Chrome(executable_path='c:\path\to\windows\webdriver\executable.exe')
File "C:\Users\hpy03\PycharmProjects\webtest\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 73, in __init__
self.service.start()
File "C:\Users\hpy03\PycharmProjects\webtest\lib\site-packages\selenium\webdriver\common\service.py", line 81, in start
raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: 'executable.exe' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home
【问题讨论】:
-
您需要将“c:\path\to\windows\webdriver\executable.exe”替换为您安装的webdriver的真实路径。它可能会有所不同。
标签: python python-3.x web-scraping