On 04/03/2016 12:57 PM, Muhammad Ali wrote:
> 
> Hi,
> 
> How can we confirm that either  PyQt4 is already installed on LInux machine 
> or not?
> 
> Please suggest commands to confirm the already existence of  PyQt4 in the 
> machine.

Ideally you make a distribution-specific package of the binary in a .deb
on Debian or an RPM on other distros, and specify that it depends on the
package that provides PyQt4.  That way when it's installed, modern
package managers will automatically install the dependencies.

Alternatively you can use try and except in your python code to attempt
to import something from PyQt4 and see if it fails or not.  This
technique is also used to make your code work either PyQt4 or PySide,
depending on which the user has installed.

try:
    from PySide import QtGui
except ImportError:
    from PyQt4 import QtGui

If neither are installed, this little example will end with an ImportError.
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to