Use à Python 2 module with Python 3

Michael Torrie torriem at gmail.com
Mon Mar 9 20:20:10 EDT 2015


On 03/09/2015 05:47 PM, Steven D'Aprano wrote:
> Michael Parchet wrote:
> 
>> Hello,
>>
>> For a new project, a person recommande me to use Python 3
>>
>> can I use Python 3 with a Python 2 y module ex : pyQt 4 ?
> 
> Maybe.
> 
> If the module is really only Python 2, then no. If it is pure-Python, with
> no C extensions, then you might be able to fork it and update it to work
> with Python 3. The 2to3 tool may help with that.
> 
> If a module's documentation says it works with Python 2, but doesn't mention
> Python 3 at all, it *might* work with Python 3. The author or maintainer of
> the project simply hasn't gotten around to fixing the documentation. So it
> may be worth just trying it and seeing for yourself.
> 
> For PyQt specifically, googling suggests that PyQt does work with Python 3,
> but the documentation is out of date and you may have difficulty installing
> it:
> 
> https://www.google.com.au/search?q=pyqt+python3

PySide does support Python 3.  Last time I installed it, I think it did
it with pip.  It will require a working C++ compiler to install it.
Both PyQt and PySide are not pure python. They have bridging code that
must be compiled.



More information about the Python-list mailing list