Py2exe, PyQt4 and Postgre Driver (QPSQL)
I`m trying to freeze my application using Py2exe.
My app uses PyQt4 and it apparently works fine with py2exe. But once I`ve uninstalled PyQt, it shows the following error:
QSqlDatabase: QPSQL driver not loaded QSqlDatabase: available drivers: QPSQL7 QPSQL
Which doesn't make any sense at all. The driver is available, but I can't use it! If PyQt4 is still installed, it works just fine.
This is my py2exe parameters:开发者_C百科
data_files = [
('sqldrivers', [
'C:\Python26\Lib\site-packages\PyQt4\plugins\sqldrivers\qsqlpsql4.dll'
])
]
setup(console=["delivery.py"], options={"py2exe" : {"includes" : ["sip", "PyQt4.QtSql", "PyQt4.QtWebKit", "PyQt4.QtNetwork"]}}, data_files=data_files)
Found it.
Just copy the file 'libpq.dll' to the application folder and it works like a charm.
精彩评论