我有一个MyApp.spec
文件,其中:
a = Analysis(...
datas=[
('file_1.jpg', '.',
('file_2.mplstyle', '.'),
]
...)
在我的代码中,这些文件用在方法中,例如plt.style.use('file_2.mplstyle')
(Python文件和此类额外文件位于同一文件夹中)。
我用编译我的代码,pyinstaller --onefile MyApp.spec
并且不会产生任何错误。
但是,在执行时file_2.mplstyle
找不到。
到目前为止,成功执行的唯一技巧是将两个文件手动复制到dist/
目录中。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句