pyinstaller未使用qtmodern数据

2024-10-01 09:37:15 发布

您现在位置:Python中文网/ 问答频道 /正文

将qtmoden库与python一起使用时。 在VS代码中运行代码时,它可以正常工作

但是在使用pyinstaller之后,它不再是了。打开生成的.exe文件时,它表示它无权访问位于-C:\Users\MyUsername\AppData\Local\Programs\Python\Python37-32\Lib\site packages\qtmoden\resources中的文件

When running the .exe aplication it errors stating: 
Traceback (most recent call last):
File "my_filename.py", line 262, in (this number differs depending on my app/code)
File "qtmodern\styles.py", line 70, in dark
File "qtmodern\styles.py", line 23, in _apply_base_theme
FileNotFoundError: [Errno 2] No such file or directory: " 'C:\sers\MyName\AppData\Local\Temp_MEI166802\qtmodern\resources/styles.qss'
[36020] failed to execute script my_filename

有人知道怎么修吗? 如何确保pyinstaller也将这2个stypes.py文件考虑在内

我尝试通过--add--data命令使用pyinstaller添加数据,并使用--paths命令包含路径,但错误消息保持不变


Tags: 文件代码inpymylocallineexe