[PyQt] Detecting which Python version is used by SIP and PyQt
Phil Thompson
phil at riverbankcomputing.com
Sat Oct 23 13:32:52 BST 2010
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".
Phil
More information about the PyQt
mailing list