[PyKDE] PyQt 4.0.1 - howto ?

Adrien Bourdet adrien.bourdet at gmail.com
Sat Jul 15 23:14:55 BST 2006


Hi,

I used PyQt3 without problem on Linux and MacOSX. A simple 'from qt  
import *' allowed me to instanciate Qt objects.

I have now a new Mac, with python 2.4, SIP 4.4.5 and PyQt 4.0.1. I'd  
like to code an 'Hello World' but i don't know wich package to  
import, or which path to configure.

I tried to compare the configurations between my 2 macs :

The working one : (python 2.3, PyQt 3)

/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site- 
packages
contains sip.so, qt.so, qtcanvas.so, etc.
in the python interpreter, sys.path contains the path for ..../site- 
packages

The new one : (python 2.4, PyQt 4)
/opt/local/Library/Frameworks/Python.framework/Versions/2.4/lib/ 
python2.4/site-packages
contains sip.so (+ sipconfig.py/sipdistutils.so) and the PyQt4 directory
the PyQt4 directory contains QtCore.so, QtGui.so, etc.

in the python interpreter, sys.path contains the path for "site- 
packages" but not for "site-packages/PyQt4"

I tried many ways to import Qt objects but i didn't manage. (even  
with adding the path for PyQt4 in sys.path)
Here is an example of error i get

Python 2.4.3 (#1, May 24 2006, 19:39:48)
[GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
 >>> import PyQt4
 >>> dir(PyQt4)
['__builtins__', '__doc__', '__file__', '__name__', '__path__']
 >>> import PyQt4.QtCore
Fatal Python error: Interpreter not initialized (version mismatch?)
Abort trap


Info : I use GCC 4, I got python 2.4 via darwinports (a packaging  
system), SIP/PyQt from riverbank site



Thanks
Adrien




More information about the PyQt mailing list