[PyQt] Detecting which Python version is used by SIP and PyQt

Hans-Peter Jansen hpj at urpla.net
Sat Oct 23 13:57:17 BST 2010


On Saturday 23 October 2010, 14:32:52 Phil Thompson wrote:
> On Sat, 23 Oct 2010 13:25:39 +0200, "Hans-Peter Jansen"
> <hpj at urpla.net>
>
> wrote:
> > On Saturday 23 October 2010, 02:54:40 Xavion wrote:
> >> Arch Linux has recently switched its 'python' package to the
> >> Python v3 branch.  SIP and PyQt still require the 'python2'
> >> package, probably because the unpatched D-Bus Python bindings
> >> currently won't work with Python v3.
> >>
> >> I'm guessing that some other Linux distributions will continue
> >> using Python v2 for a while yet.  Due to this uncertainty, I'm
> >> thinking that the Makefiles of my applications should detect
> >> whether PyQt is attached to Python v2 or v3.
> >
> > How about:
> >
> > python -c 'import sys, sipconfig; sys.stdout.write("%s\n" %
> > (sipconfig._pkg_config['py_version'] >> 16))'
> >
> > but hold on a second.
> >
> > Phil, there's an issue in this area:
> >
> > $ python -c 'import sys, sipconfig; sys.stdout.write("%s\n" %
> > (sipconfig._pkg_config['py_version'] >> 16))'
> > Traceback (most recent call last):
> >   File "<string>", line 1, in <module>
> > NameError: name 'py_version' is not defined
>
> Your quotes are wrong - use "py_version".

Silly me, return ERR_NOTENOUGHCAFFEINATION

Pete




More information about the PyQt mailing list