Pyinstaller添加数据文件 [英] Pyinstaller adding data files

查看:913
本文介绍了Pyinstaller添加数据文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在与pyinstaller苦苦挣扎.每当我使用kivy GUI和.kv文件构建此特定脚本并在构建后运行.exe时,都会出现致命错误:

I'm struggling with pyinstaller. Whenever I build this specific script with a kivy GUI and a .kv file, and run the .exe after the build, I get a fatal error:

IOError: [Errno 2] No such file or directory: 'main.kv'

我尝试使用--add-data添加.kv文件以及mdb和dsn文件(用于pypyodbc),但出现错误:unrecognized arguments: --add-data'main.kv'. (提到的其他文件还有更多的--add-data参数.)

I've tried adding the .kv file, as well as a mdb and dsn file (for pypyodbc) using --add-data, but I get an error: unrecognized arguments: --add-data'main.kv'. (There were more --add-data arguments for the other files mentioned.)

此方法或替代方法是否有解决方案?

Are there any solutions for this or maybe alternative methods?

推荐答案

如果检查pyinstaller -h以获得帮助,则可以找到--add-data选项的用法,例如[--add-data <SRC;DEST or SRC:DEST>].因此,请尝试

If you check pyinstaller -h for help, you can find --add-data option works like this [--add-data <SRC;DEST or SRC:DEST>]. So in your case try

pyinstaller -F --add-data "main.kv;main.kv" yourtarget.py

这篇关于Pyinstaller添加数据文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆