Mac OS X 10.10 Installation PYQT Process 1.0

Source: Internet
Author: User

Loading PYQT requires three packages:
Qt, SIP, PyQt


QT package in http://www.qt.io/download download, I am under the 5.4.0 free version. (Note: At present, do not under the latest QT 5.5.0, although this version of the Mac OS X 10.10retina screen, but it seems to have not been equipped with its PYQT package, I just started the QT 5.5.0 results for license reasons can not be installed)

SIP package and PyQt are all in http://www.riverbankcomputing.com download, I am under the latest development version, respectively, is sip4.16.8, pyqt-gpl-5.4.2


Overall, I installed the most up-to-date version of the package, the online I find the installation method is somewhat outdated, will produce some errors, so I write this article, share the latest installation process.


I use the system is Mac OSX 10.10,10.8, 10.9 system should also apply this article, other systems are not guaranteed.


1, enter which Python in terminal (Ternimal), view the current Python version and installation path, update the Python version, not detailed


2, QT has the installation program, directly installed on the line, choose a suitable installation path, this path can be useful for a while. The assumption here is/users/admin/qt5.4.0


3, decompression sip to a path, assuming that/users/admin/sip-4.16.8,sip need to compile their own installation, the process is as follows:
①: Open Terminal (Terminal)

Ii:
cd/users/admin/sip-4.16.8
Python configure.py
Make
Make install

4, decompression PyQt to a path, assuming that/USERS/ADMIN/PYQT-GPL-5.4.2,PYQT also need to compile their own installation, the process is as follows:
Note: Prior versions of PYQT may need to be modified in the configure.py file:
' Qtwebkitwidgets ': Modulemetadata (qmake_qt=[' webkitwidgets '),
Revision changed to
' Qtwebkitwidgets ': Modulemetadata (qmake_qt=[' webkitwidgets ', ' Printsupport ']),
If you download the pyqt-gpl-5.4.2 or later version of it will not be modified, because it has been changed.

Open Terminal (Terminal):

cd/users/admin/pyqt-gpl-5.4.2

Python configure.py--qmake/users/admin/qt5.4.0/5.4/clang_64/bin/qmake
Make
Make install


The installation is now complete
Can run a run of the sample program to see if the installation was successful:
Import Sys
From PYQT5 import Qtcore, Qtgui, qtwidgets

if __name__ = = ' __main__ ':
App = Qtwidgets.qapplication (SYS.ARGV)
W = Qtwidgets.qwidget ()
W.resize (250, 150)
W.move (300, 300)
W.setwindowtitle (' simple ')
W.show ()
Sys.exit (App.exec_ ())

The effect is as follows:

Mac OS X 10.10 Installation PYQT Process 1.0

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.