我正在嘗試在 Google Colab 中使用 Selenium,但是當我嘗試運行 Firefox 實體時出現一些錯誤。我跟著這個鏈接:
整個錯誤:
--------------------------------------------------------------------------- FileNotFoundError Traceback (most recent call last) /usr/local/lib/python3.7/dist-packages/selenium/webdriver/common/service.py in start(self) 75 stdin=PIPE, ---> 76 creationflags=self.creationflags) 77 except TypeError: 4 frames FileNotFoundError: [Errno 2] No such file or directory: '/content/drive/MyDrive/Santillana/geckodriver': '/content/drive/MyDrive/Santillana/geckodriver' During handling of the above exception, another exception occurred: WebDriverException Traceback (most recent call last) /usr/local/lib/python3.7/dist-packages/selenium/webdriver/common/service.py in start(self) 81 raise WebDriverException( 82 "'%s' executable needs to be in PATH. %s" % ( ---> 83 os.path.basename(self.path), self.start_error_message) 84 ) 85 elif err.errno == errno.EACCES: WebDriverException: Message: 'geckodriver' executable needs to be in PATH.uj5u.com熱心網友回復:
此錯誤訊息...
FileNotFoundError: [Errno 2] No such file or directory: '/content/drive/MyDrive/Santillana/geckodriver': '/content/drive/MyDrive/Santillana/geckodriver'...意味著您的程式無法找到GeckoDriver可執行檔案。
分析
根據錯誤訊息,您似乎處于linux系統。但是你已經下載了視窗GeckoDriver版本:
![FileNotFoundError: [Errno 2] No such file or directory: '/content/drive/MyDrive/Santillana/geckodriver' 在 Google Colab 中使用 Selenium 庫](https://img.uj5u.com/2022/01/25/f7df1ccb1296461bbe8d070c3857d0e2.png)
解決方案
您可能需要下載Linux版本的GeckoDriver可執行檔案,而不是Windows版本的GeckoDriver。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/420599.html標籤:
