PyQt4 for Mac OS 10.82013-04-27 06:59 5744 People read comments (0) favorite reports Classification:PYTHON/PYQTpython (+)
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Because you want to cross-platform, so consider QT, and want to combine the convenience of scripting. Consider PYQT
Online search for a bit, the data is very small. Some of it is the same as the previous information.
Refer here Http://www.noktec.be/Python/how-to-install-pyqt4-on-osx
1: Download and install QT
Http://qt-project.org/downloads
I downloaded QT 5.0.2 for Mac (404 MB) (Info)
It is very convenient to install. Do not say
2: Download SIP
Http://www.riverbankcomputing.co.uk/software/sip/download
I downloaded the sip-4.14.7-snapshot-bd9eccac4407.tar.gz.
Unzip after download
[Plain]View PlainCopy
CD sip-4.14.7-snapshot-bd9eccac4407
Python configure.py-d/library/python/2.7/site-packages--arch=i386
Make
sudo make install
It's not a problem to set up.
3: Download PyQt4
Http://www.riverbankcomputing.co.uk/software/pyqt/download
I downloaded the pyqt-mac-gpl-snapshot-4.10.2-ffcf323516fc.tar.gz.
Download and unzip the installation configuration here to refer to the revised configuration document, the new version is configure-ng.py:
Http://pyqt.sourceforge.net/Docs/PyQt4/installation.html#configuring-pyqt4
Command
[Plain]View PlainCopy
CD PYQT-MAC-GPL-SNAPSHOT-4.10.2-FFCF323516FC
Python configure-ng.py-q/users/watsy/qt5.0.2/5.0.2/clang_64/bin/qmake-d/library/python/2.7/site-packages/--sip/ System/library/frameworks/python.framework/versions/2.7/bin/sip
Make
sudo make install
When the above steps are complete, run the demo
[Python]View PlainCopy
#!/usr/bin/python
#-*-Coding:utf-8-*-
"""
Zetcode PYQT4 Tutorial
In this example, we create a simple
Window in PyQt4.
Author:jan Bodnar
Website:zetcode.com
Last Edited:october 2011
"""
Import Sys
From PyQt4 import Qtgui
def main ():
App = Qtgui.qapplication (SYS.ARGV)
W = Qtgui.qwidget ()
W.resize (. )
W.move (+ )
W.setwindowtitle (' simple ')
W.show ()
Sys.exit (App.exec_ ())
if __name__ = = ' __main__ ':
Main ()
Execution gets the following error
[Python]View PlainCopy
Traceback (most recent):
File "pyqtdemo.py", line + , in <module>
From PyQt4 import Qtgui
Importerror:dlopen (/library/python/2.7/site-packages/sip.so, 2): no suitable image found. Did find:
/library/python/2.7/site-packages/sip.so:mach-o, but wrong architecture
In considering what the problem is
View
[Plain]View PlainCopy
Lipo-info/library/python/2.7/site-packages/sip.so
Get
[Plain]View PlainCopy
Non-fat file:/library/python/2.7/site-packages/sip.so is architecture:i386
Now it's a 64-bit system for machines.
Modify SIP configuration from new compilation
[Python]View PlainCopy
CD sip-4.14. 7-snapshot-bd9eccac4407
Python configure.py-d/library/python/2.7/site-packages--arch=x86_64
Make
sudo make install
Run demo after installing the Bowl
perfect~
PyQt4 for Mac OS 10.8