我正在运行 pyinstaller 并且有多个依赖项。其中两个是 pandasgui 和 qtstylish。但对于这两个依赖项,它仅包含 dist-info,而不包含包本身。当我尝试执行我的
tool.exe
时,出现以下错误:
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\...\\AppData\\Local\\Temp\\_MEI308162\\qtstylish\\compiled/dark.qss'
PyInstaller命令:
pyinstaller --onedir --windowed --collect-submodules pandasgui --name tool -p . tool/main.py
需求.txt
...
pandasgui==0.2.14 ; python_version >= "3.10" and python_version < "3.11" \
--hash=sha256:22eac39cb44815091565862ecd7af6ac46fa383a7269755ad7c105585a1b988a
qtstylish==0.1.5 ; python_version >= "3.10" and python_version < "3.11" \
--hash=sha256:3402562d8b92d0de3706a8478323a998bfe92f29572bdf07ef205895b1a1a29a
...
正如您在命令中看到的,我尝试通过
--collect-submodules pandasgui
解决该问题。如果您需要更多信息,请留下命令。
要解决当前错误,您可以使用
--collect-all
标志和 qtstylish
作为参数,以收集 qtstylish
包附带的所有非源模块的附加文件。
例如你可以这样做
pyinstaller -w --collect-all qtstylish --name tool -p . tool/main.py