short.朋友
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from time import sleep
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.support.ui import WebDriverWait
import time
print("Opening...")
driver = webdriver.Chrome('chromedriver.exe')
driver.get('https://google.com')
将上述脚本文件转换为可执行文件:
pyinstaller short.py
执行short.exe
时给我错误:
Fatal Python error: initfsencoding: unable to load the file system codec
zipimport.ZipImportError: can't find module 'encodings'
我的Python版本是3.7
,任何人都可以建议采取最合适的纠正措施吗?
不支持Python 3.7。在向OP询问相关问题后,可以肯定地说,在使用Pyinstaller进行编译时,他们使用的是不受支持的Python版本。
建议的替代方案:等待在Pyinstaller的更高版本中引入3.7的支持。将Python env恢复为3.6x(首先检查兼容Python版本的Pyinstaller网站形式)确保Pyinstaller尚未发布支持版本,在这种情况下,您可能需要更新Pyinstaller。
请按照下面的链接,评论建议您可以自己构建引导程序
希望这有帮助,斯威夫特