1
因此,我已閱讀了所有這些問題,但無法瞭解我爲什麼無法正常工作。我有一個的.spec文件看起來像這樣:在PyInstaller中使用.spec文件捆綁數據
# -*- mode: python -*-
block_cipher = None
a = Analysis(['newtestsphinx.py'],
pathex=['C:\\Program Files (x86)\\speechfolder'],
hiddenimports=[],
hookspath=None,
runtime_hooks=None,
excludes=None,
cipher=block_cipher)
pyz = PYZ(a.pure,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas + [('grammar2.jsgf', 'C:\\Program Files (x86)\\speechfolder\\grammar2.jsgf', 'DATA')],
name='newtestsphinx.exe',
debug=False,
strip=None,
upx=True,
console=True)
所以像所有的例子,如果我理解他們,我說「grammar2.jsgf」在根目錄下的包,我相信這種格式爲[ 'path_to_put_in', 'path_its_in_now', '標籤']
於是我運行命令來創建我的新文件:
pyinstaller --onefile newtestsphinx.spec
的第一件事情我現在在我的代碼是這樣的:
print os.path.isfile('grammar2.jsgf')
它返回false 100%,我的程序也找不到要使用它的文件。任何幫助將是真棒,謝謝!