python - 为Windows制作一个可执行的kivy文件,pyinstaller有问题
问题描述
我的目录中有4个文件:
kv
文件py
文件- SQLite 数据库
py
我要导入文件的py(2)
文件
当我使用pyinstaller --onefile main.py
它时,它会创建一个.exe
文件。当我在控制台中运行此文件时,它会打印出:(No such file in directory: 'struct.kv'
我的 kv 文件)。
我想将它添加到规范文件中。我写from kivy.deps import sdl2, glew
了两行:
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
[Tree(p) for p in (sdl2.dep_bins + glew.dep_bins)],
以及数据中发生的所有事情:datas=[ ( '/src/struct.kv', '.' )]
. 但是当我尝试时,pyinstaller main.spec
我收到了这个警告:
502 WARNING: stderr: exec(text, spec_namespace)
File "<string>", line 2, in <module>
504 WARNING: stderr: File "<string>", line 2, in <module>
ImportError: cannot import name 'sdl2'
509 WARNING: stderr: ImportError: cannot import name 'sdl2'
为什么我不能导入?
解决方案
推荐阅读
- javascript - Axios/Fetch 回调在事件循环中去哪里了?
- php - 如何在自定义插件中包含 WooCommerce 条件标签
- django - 是否可以检查函数是否具有来自 DRF 和 Django 中的类属性的装饰器?
- c - elf文件格式,顺序是什么?
- python - 无法使用 python 请求库下载压缩的 csv 文件
- blazor - 如何在带有 blazor 的 Razor 类库中使用新的 NET 6 静态资产
- angular - 路由未重定向到预期页面
- r - 如何将 colMeans 结果添加到 R 中保留 data.frame 的最后一行?
- go - 如何在 Go 中编写双向映射?
- docker - 重命名devilbox所在的文件夹后,数据库消失了。我该如何移动它们?