我刚刚找到了一种方法来支持QtCore中的所有图像格式,如下所示
from PySide imnport QtCore...
QtCore.QCoreApplication.addLibraryPath(os.path.join(os.path.dirname(QtCore.__file__), "plugins"))但是,当我在Windows下用PyInstaller构建应用程序时,我仍然对支持JPEG/BPM有问题.看起来这个路径没有添加到编译的应用程序中。
我该怎么加呢?
发布于 2015-03-31 14:44:29
基于Windows的简单思想
我将以下代码添加到我的app.spec文件中:
from PySide import QtCore
plugins=os.path.join(os.path.dirname(QtCore.__file__), "plugins\\imageformats")
static_files += Tree(plugins, 'plugins\\imageformats')以及app.py(主要形式):
QtCore.QCoreApplication.addLibraryPath(os.path.join(os.path.dirname(QtCore.__file__), "plugins"))一切正常!
https://stackoverflow.com/questions/29335470
复制相似问题