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

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • PLEASE READ THE FOLLOWING APPLE DEVELOPER PROGRAM LICENSE...
    念念不忘的阅读 13,535评论 5 6
  • 简书的 markdown 没有目录,截图一张,让大家看的清楚,找到自己需要的东西。 更新日志:2017年12月3日...
    inke阅读 91,230评论 57 225
  • Qt是属于一个跨平台的GUI开发软件,支持的平台有Unix、Linux、Windows/WinCE、IOS等。 Q...
    一叶之界阅读 8,205评论 0 17
  • NAME dnsmasq - A lightweight DHCP and caching DNS server....
    ximitc阅读 2,928评论 0 0
  • 去琴房途经操场 一群鸽子进食 不理我? 挥舞双臂,吓 鸽子低飞又落 如雷般吼、再吓 飞而又落 噢、噢、啊、啊 连吼...
    天马谣阅读 362评论 0 1