Install PyQt5

1 install Qt5

download the install file from http://download.qt.io/official_releases/qt/5.6/5.6.0/qt-opensource-linux-x64-5.6.0.run
set the executive right of downloaded file.
chmod a+x qt-opensource-linux-x64-5.6.0.run
Follow the guide to finish the installation.
Add the Qt path to bash environment.

export QTDIR=/opt/Qt5.6.0/5.6/gcc_64
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${QTDIR}/lib
export PATH=${QTDIR}/bin:${PATH}

To test the installation, use qmake command.

2 install SIP before PyQt

download the source file from http://liquidtelecom.dl.sourceforge.net/project/pyqt/sip/sip-4.17/sip-4.17.tar.gz

tar xvf sip-4.17/sip-4.17.tar.gz
cd sipsip-4.17/sip-4.17
python configure.py
sudo make
sudo make install

To test the installation, use sip -V command.
In python,

>>> import sip  
>>> print(sip.SIP_VERSION_STR)

3 install PyQt5

download the source file from http://iweb.dl.sourceforge.net/project/pyqt/PyQt5/PyQt-5.5.1/PyQt-gpl-5.5.1.tar.gz

tar xvf PyQt-gpl-5.5.1.tar.gz
cd PyQt-gpl-5.5.1
python configure.py
sudo make
sudo make install

Although the installation process seems successfully. When we import some modules of PyQt5, there's an error "No module named 'PyQt5'".
Then we check the build process of PyQt. The same problem was discussed in http://stackoverflow.com/questions/21486103/pyqt5-without-qtgui-and-qtwidgets
The reason is the installation may be missing OpenGL. The solution is

sudo apt-get install freeglut3-dev

Then

python configure.py

works correctly.

ALL DONE

你可能感兴趣的:(Install PyQt5)