【发布时间】:2019-06-25 12:09:09
【问题描述】:
在我在这里问之前,我不知道如何创建一个可执行的 python 程序。谢天谢地,我收到了一个快速的答复,并且能够将我的脚本转换为可执行程序。可执行文件完美运行,但仅在我的计算机上运行。 这是我收到的两个错误,我觉得我需要修改脚本才能找到 chrome 驱动程序我不确定 Pyinstaller 将所有内容保存在哪里。
Exception in Tkinter callback
Traceback (most recent call last):
File "site-packages\selenium\webdriver\common\service.py", line 76, in start
File "subprocess.py", line 775, in __init__
File "subprocess.py", line 1178, in _execute_child
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 "tkinter\__init__.py", line 1705, in __call__
File "MarijuanaDoctors.py", line 25, in search
File "site-packages\selenium\webdriver\chrome\webdriver.py", line 68, in __init__
File "site-packages\selenium\webdriver\common\service.py", line 83, in start
selenium.common.exceptions.WebDriverException: Message: 'chromedriver'
executable needs to be in PATH. Please see
https://sites.google.com/a/chromium.org/chromedriver/home
【问题讨论】:
-
简短回答:Pyinstaller 不保存 chromedriver,只保存与 chromedriver 交互的 python 文件。要存储其他数据,请查看 pyinstaller 文档。 Python -(使用)-> chromedriver.exe -(控制)-> chrome.exe。 chromedriver.exe 和 chrome.exe 的路径必须在您的 python 代码中隐式或显式定义。
标签: python selenium tkinter pyinstaller