我想用pyinstaller打包一個PyQt應用程序。我simplyfied目錄樹看起來如下:pyinstaller:從導入的模塊添加缺少的數據
maindir/
├── build/
├── dev_tool.py
├── dev_tool.spec
├── dist
│ └── dev_tool/
└── ...
當我從dist/
文件夾
$ ./dist/dev_tool/dev_tool
運行可執行文件dev_tool
我得到的錯誤,這是無法找到.../dev_tool/langdetect/utils/messages.properties
。但是,當我手動添加langdetect
文件夾(我簡單地從我的python站點包中複製pip install langdetect
-ed後)它可以工作。現在我通過在.spec
文件here中定義它來了解如何添加文件,但是,如果我嘗試將langdetect/
文件夾從我的Python站點包複製到dist/dev_tool/
文件夾中,它仍然不起作用。
添加以下行到我的dev_tool.spec
文件
a = Analysis (...
datas=[('path_to.../site-packages/langdetect', 'dist/dev_tool/langdetect')]
...)
不應該在該副本一切從站點包langdetect文件夾dist/dev_tool/langdetect/
?
這裏的任何幫助將非常感激。