PyInstaller 不识别相对路径

问题描述

我正在尝试为我的 python 应用程序生成一个 .exe。在代码中,我导入了一些嵌入文件,如下所示:

f = open('source/store/data_dictionary.json')

尝试从生成的 .exe 运行应用程序,我收到如下错误:

FileNotFoundError: [Errno 2] No such file or directory: 'source/store/data_dictionary.json'

full output error from the console

要生成 .exe,我运行了:

pyinstaller --onefile app.py

我不知道是否有更好的方法在 python 脚本中导入文件以生成可执行文件,或者我是否必须编写一些设置。

你可以在这里查看我的源代码:https://github.com/GraphFilter/GraphFilter

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)