在 pyinstaller 2.0 中添加 .c 和 .h 文件不起作用

Add .c and .h file in pyinstaller 2.0 not working

因为我参考了 Embed icon in python script @ali3n-w0r1d 的回答。

我添加了图标文件,它对我来说完全没问题,但我想添加 example.c 和 example.h 文件。那么我需要在 .spec 文件和我的 python 脚本中添加哪些更改。

我解决了我的问题。所以这是我的 .spec 文件。我把我的 example_doxigen.c example_doxigen.h 和 logo.ico 文件在我的目录中 python 文件存储的位置。

# -*- mode: python -*-
a = Analysis([os.path.join(HOMEPATH,'doxygen_skeleton.py')],
         pathex=['E:\pyinstaller-2.0\pyinstaller-2.0', 'E:\pyinstaller-2.0\pyinstaller-2.0\utils'],
         hiddenimports=[],
         hookspath=None)
a.datas += [ ('logo.ico', 'E:\pyinstaller-2.0\pyinstaller-2.0\logo.ico', 'DATA')]
a.datas += [ ('example_doxigen.c', 'E:\pyinstaller-2.0\pyinstaller-2.0\example_doxigen.c', 'DATA')]
a.datas += [ ('example_doxigen.h', 'E:\pyinstaller-2.0\pyinstaller-2.0\example_doxigen.h', 'DATA')]
pyz = PYZ(a.pure)
exe = EXE(pyz,
      a.scripts,
      a.binaries,
      a.zipfiles,
      a.datas,
      name=os.path.join('dist', 'doxygen_skeleton.exe'),
      debug=False,
      strip=None,
      upx=True,
      console=False , icon='E:\pyinstaller-2.0\pyinstaller-2.0\logo.ico')