执行在python中创建的应用程序时出现致命的Python错误

问题描述 投票:3回答:1

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 python-3.x selenium exe pyinstaller
1个回答
1
投票

不支持Python 3.7。在向OP询问相关问题后,可以肯定地说,在使用Pyinstaller进行编译时,他们使用的是不受支持的Python版本。

建议的替代方案:等待在Pyinstaller的更高版本中引入3.7的支持。将Python env恢复为3.6x(首先检查兼容Python版本的Pyinstaller网站形式)确保Pyinstaller尚未发布支持版本,在这种情况下,您可能需要更新Pyinstaller。

请按照下面的链接,评论建议您可以自己构建引导程序

Link to issue on GitHub

希望这有帮助,斯威夫特

© www.soinside.com 2019 - 2024. All rights reserved.