Ubuntu 14 configure and install pyqt4 and pyqt5

Source: Internet
Author: User
1. Install pyqt4

We recommend that you use apt-get to install pyqt4.


sudo apt-get install libxext6 libxext-dev libqt4-dev libqt4-gui libqt4-sql qt4-dev-tools qt4-doc qt4-designer qt4-qtconfig "python-qt4-*" python-qt4
Very simple. It mainly records pyqt5 in the python3 environment.


2. Install pyqt5

2.1.python sip install

First download the SIP

tar -xvf sip*.tar.gz python configure.py make  sudo make install

2.2 install qt5

Here is the source download, http://www.riverbankcomputing.co.uk/software/pyqt/download5

There are also run file downloads, http://qt-project.org/downloads

Source or./configure & make & sudo make install. If it is run, add the X permission first.

Sudo chmod + x **. Run

After installation, add the path to the environment variable ~ /. Bash_profile, mine is

export PATH=$PATH:/opt/Qt5.3.1/5.3/gcc_64/bin

sudo ln -s /opt/Qt5.3.1/5.3/gcc_64/bin/qmake /usr/local/bin



2.3 pyqt5 install

To install pyqt5, you need the above sip and qmake. Therefore, you need to install qt5 first.

Replace the following qmake with your directory and site-packages/, that is, the package location, and then compile

$python configure.py

Install

sudo make && sudo make install

A simple example is as follows:

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_())

If any compilation error occurs, try

sudo ARCHFLAGS="-Wno-error=unused-command-line-argument-hard-error-in-future"

Add the command



Ubuntu 14 configure and install pyqt4 and pyqt5

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.