Still wrong architecture on Snow Leopard

Ned Deily nad at acm.org
Tue Oct 13 10:23:20 CEST 2009


In article <89F50109-83F9-4C1E-8E0D-7F985B1C2292 at xiao-yu.com>,
 Xiao Yu <xiao at xiao-yu.com> wrote:
> I have Snow Leopard and followed 4.6.1 snapshot 20091010's reference  
> 3.4 instructions to configure both SIP and PyQt in i386. Everything  
> installed fine but when I open Python and tried to import ImageQt, I  
> get the following error:
> Traceback (most recent call last):
>    File "<stdin>", line 1, in <module>
>    File "/Library/Python/2.6/site-packages/PIL/ImageQt.py", line 20,  
> in <module>
>      from PyQt4.QtGui import QImage, qRgb
> ImportError: dlopen(/Library/Python/2.6/site-packages/PyQt4/QtGui.so,  
> 2): no suitable image found.  Did find:
> 	/Library/Python/2.6/site-packages/PyQt4/QtGui.so: mach-o, but wrong  
> architecture
> 
> What am I still doing wrong? Is there a specific way I have to run  
> Python etc?

The Apple-supplied Python 2.6 in Snow Leopard runs by default in 64-bit 
mode.  If the PyQt4 was only built for i386, i.e. 32-bit mode, try 
forcing Apple python to run in 32-mode by either setting an environment 
variable:

# one-time
VERSIONER_PYTHON_PREFER_32_BIT=yes /usr/bin/python

# always in this session (or add to shell profile)
export VERSIONER_PYTHON_PREFER_32_BIT=yes
/usr/bin/python

or you can use the defaults command to permanently prefer 32-bit.  See 
Apple's python man page for details.

-- 
 Ned Deily,
 nad at acm.org




More information about the Python-list mailing list