简体   繁体   English

转换为exe时出现Python pyinstaller错误

[英]Python pyinstaller error when converting to exe

These are the erros when i converted to exe and run it:这些是我转换为 exe 并运行它时的错误:

 Traceback (most recent call last): File "NoneServerV1.py", line 24, in <module> File "<frozen importlib._bootstrap>", line 991, in _find_and_load File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 671, in _load_unlocked File "c:\\users\\glasmor\\appdata\\local\\programs\\python\\python38-32\\lib\\site-packages\\PyInstaller\\loader\\pyimod03_importers.py", line 493, in exec_module exec(bytecode, module.__dict__) File "pyrebase\\__init__.py", line 1, in <module> File "<frozen importlib._bootstrap>", line 991, in _find_and_load File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 671, in _load_unlocked File "c:\\users\\glasmor\\appdata\\local\\programs\\python\\python38-32\\lib\\site-packages\\PyInstaller\\loader\\pyimod03_importers.py", line 493, in exec_module exec(bytecode, module.__dict__) File "pyrebase\\pyrebase.py", line 18, in <module> File "<frozen importlib._bootstrap>", line 991, in _find_and_load File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 671, in _load_unlocked File "c:\\users\\glasmor\\appdata\\local\\programs\\python\\python38-32\\lib\\site-packages\\PyInstaller\\loader\\pyimod03_importers.py", line 493, in exec_module exec(bytecode, module.__dict__) File "gcloud\\__init__.py", line 19, in <module> File "pkg_resources\\__init__.py", line 480, in get_distribution File "pkg_resources\\__init__.py", line 356, in get_provider File "pkg_resources\\__init__.py", line 899, in require File "pkg_resources\\__init__.py", line 785, in resolve pkg_resources.DistributionNotFound: The 'gcloud' distribution was not found and is required by the application [3108] Failed to execute script NoneServerV1

Maybe someone can help me(I think the problem is with pyrebase bcs i coded a login and auth system with it)也许有人可以帮助我(我认为问题出在 pyrebase bcs 上,我用它编写了登录和身份验证系统)

If you are using the --onefile switch try to make a build without the switch.如果您使用--onefile开关,请尝试在没有开关的情况下进行构建。 This will generate a folder where you can find a smaller exe.这将生成一个文件夹,您可以在其中找到一个较小的 exe。 Run it and check if you have the same error.运行它并检查是否有相同的错误。 In the folder check if the gcloud package exists.在文件夹中检查 gcloud 包是否存在。 It looks like it is not able to find the gcloud package.好像找不到 gcloud 包。

If it doesn't exist then use the switch --hidden-import gcloud .如果它不存在,则使用开关--hidden-import gcloud

i fixed it by creating in lib/site-packages/pyinstaller/hooks a file called hook-gcloud.py and i edited it with: from PyInstaller.utils.hooks import copy_metadata我通过在 lib/site-packages/pyinstaller/hooks 中创建一个名为 hook-gcloud.py 的文件来修复它,并使用以下命令对其进行了编辑: from PyInstaller.utils.hooks import copy_metadata

datas = copy_metadata('gcloud') datas = copy_metadata('gcloud')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Python pyinstaller 将 py 转换为 exe 时出错 - Python pyinstaller error when converting py to exe 使用 pyinstaller 将 python 文件转换为 an.exe 文件时出现 opencv 错误 - opencv error when converting a python file to an .exe file with pyinstaller 转换为.exe Pyinstaller时的Chromedriver路径错误 - Chromedriver Path Error when converting to .exe Pyinstaller 将.py转换为.exe时出现Pyinstaller错误 - Pyinstaller Error when converting .py to .exe 使用 PyInstaller 将 python 3.7 脚本转换为 exe 时出错:ModuleNotFoundError - Error while converting python 3.7 script to exe using PyInstaller: ModuleNotFoundError Pyinstaller - “致命错误! 将脚本转换为 exe 时无法执行脚本” - Pyinstaller - “Fatal error ! Failed to execute script” when converting script to exe 将 python 文件转换为可执行文件时出现 Pyinstaller 脚本错误 - Pyinstaller script error when converting a python file into an executable 使用 pyinstaller 将我的 python gui 程序转换为 .exe 时出现致命错误 - Getting a fatal error while converting my python gui program to .exe using pyinstaller Python - 执行 .exe 时 pyinstaller 脚本不起作用 - Python - pyinstaller script not working when executing the .exe Pyinstaller 运行 exe 文件时出错 - Pyinstaller Error when running the exe file
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM