[PyQt] Moving PyQt programs to Python 3

Mike Ramirez gufymike at gmail.com
Fri Jul 15 03:35:48 BST 2011


On Friday 15 July 2011 11:42:59 Algis Kabaila wrote:
> If I get binaries for PyQt I can ascertain the version of PyQt and Qt
> itself, but AFAIK there is no way of ascertaining which breed of python,
> 2.x or 3.x, PyQt is bound to.  IMHO it would be useful to have
> PYTHON_VERSION_STR, just like the PYQT_VERSION_STR for identification
> purposes. Without it there will occasionally be confusion of matching
> Python version with the right PyQt version, whilst we are in a 2 to 3
> transition state.
> 

How's this?  I'm assuming you want a string version of both...

from PyQt4.Qt import PYQT_VERSION_STR
import sys

print("PyQt: {0}\nPython: {1}".format(PYQT_VERSION_STR, sys.version))

You're trying to figure out if pyqt is built for 2.6/2.7/3.1/3.2... it should 
exist in that python versions lib/python${VERSION}/site-packages directory (or 
for windows Python${VERSION}/Lib/site-packages), unless you're making a boo-
boo manually setting  your PYTHONPATH so one package lib affects all 
versions....  I would suggest only setting up PYTHONPATH for libraries and 
apps you're working on, static libs should go in the site-packages directory 
for this specific reason.

Mike




More information about the PyQt mailing list