[PyQt] Deploying PyQt4 on Linux

Hans-Peter Jansen hpj at urpla.net
Sat Jun 27 17:59:18 BST 2009


Am Donnerstag, 25. Juni 2009 schrieb Andreas Pakulat:
> On 25.06.09 11:04:30, Hans-Peter Jansen wrote:
> > Am Donnerstag, 25. Juni 2009 schrieb ion vasilief:
> > > Hello everybody,
> > >
> > > I'm trying to deploy an application ("my_app")
> > > that uses Qt, Python, PyQt4 and SIP on Linux in a distribution
> > > independent way (meaning that even if there are other default
> > > versions of these libraries installed on the system, my_app will load
> > > at run time the symbols from the libraries I have built it against).
> > > My idea was to deploy all the necesarry dependencies in the
> > > /usr/local/my_app/lib folder.
> > >
> > > Therefore
> > > I have compiled Qt 4.5.1 and Python 2.6 with the
> > > --prefix=/usr/local/my_app option. After that I have built SIP and
> > > PyQt4 using Qt/Python versions previousely built. Finally I have
> > > compiled my application against all these libraries. At run time,
> > > PyQt4 still loads the default Qt 4.5.0 installed on the system (in
> > > /usr/lib), instead of the Qt 4.5.1 version from the
> > > /usr/local/my_app/lib folder. The only solution I have found is to
> > > modify the QTDIR environement variable, but I don't want to mess with
> > > that when I deploy my application.
> > >
> > > My question: is there a way to force PyQt4 to load the symbols from
> > > the Qt version it was built against?
> >
> > That's gonna be tough. You WILL have to fiddle with QTDIR and most
> > probably with LD_LIBRARY_PATH, but just do it in a shell wrapper.
>
> No need for that, especially QTDIR is completely unknown to Qt4. That
> variable simply doesn't exist anymore. You can adjust LD_LIBRARY_PATH to
> poin to the Qt library, however you can also manage to do it without. Use
> the RPATH and RUNPATH stuff when linking PyQt to your Qt, you'll have to
> adjust the PyQt buildsystem for that I think and you probably want to
> make sure that you use relative paths so your app can be installed
> anywhere on the target system.

You're right. For what is worth, you may want to try PyInstaller. Probably 
it solves most problems out of the box. At least, that's the projects 
purpose.

Pete


More information about the PyQt mailing list