我编写了使用svg图像作为图标的python应用程序。使用py2exe编译PyQt4 python代码后不会出现SVG图像
QtGui.QIcon(':icons/icon.svg') <- just like this
它在我的计算机上工作,但编译后与py2exe并在另一台计算机上运行,theres没有图标。 如果我尝试BMP格式,一切正常。所以我认为这可能是一些图书馆问题。 我不知道PyQt4用于svg图形。
在setup.py文件我写
dllList = ('mfc90.dll','msvcp90.dll','qtnetwork.pyd','qtxmlpatterns4.dll', 'qsvg4.dll', 'qsvgd4.dll')
origIsSystemDLL = py2exe.build_exe.isSystemDLL
def isSystemDLL(pathname):
if os.path.basename(pathname).lower() in dllList:
return 0
return origIsSystemDLL(pathname)
py2exe.build_exe.isSystemDLL = isSystemDLL
setup(windows=[{"script" : "myApp.py"}], options={"py2exe" : {"includes" : ["sip", "PyQt4.QtNetwork", "PyQt4.QtWebKit", "PyQt4.QtSvg" ]}})
,也有imageformats文件夹(与qvg4.dll等)列入目录MYAPP.EXE
因此,如何解决这个问题?
感谢, 亚雷克
如果您愿意放弃插件文件夹(将顶级应用程序文件夹中的图标引擎放置),那么您不需要qt.conf。 – Compholio 2017-04-21 00:15:51