Qt5.5和PyQt5.5在UbuntuKylin15.04的快速安裝腳本

    Qt5.5已經發布了,前兩天PyQt也很快推出了一個5.5的對應版本。試驗了一下(花了個週末啊!),真是愈來愈好用了。Qt5.5在Ubuntu15.04上有一些重要的改進,在虛擬機裏運行的窗口覆蓋問題也終於沒有了。由於要裝好幾個軟件,挺花功夫的。這裏給出個腳本,能夠快速安裝。python

首先安裝Qt5.5。linux

#在線安裝用這個.
wget http://download.qt.io/official_releases/online_installers/qt-unified-linux-x64-online.run
chmod +x qt-unified-linux-x64-online.run
./qt-unified-linux-x64-online.run

#離線安裝用這個.
wget http://download.qt.io/official_releases/qt/5.5/5.5.0/qt-opensource-linux-x64-5.5.0-2.run
chmod +x qt-opensource-linux-x64-5.5.0-2.run
./qt-opensource-linux-x64-5.5.0-2.run

而後,設置一下Qt的路徑。shell

#Add Qt Path to /etc/profile.
sudo gedit /etc/profile
#add line: 
export PATH=$PATH:/home/userXXX/Qt/Qt5.5/gcc_64/bin

通常新裝的系統須要安裝OpenGL的支持。ui

sudo apt-get install libgl1-mesa-dev

    注意:目前的Qt5.5版本的在線安裝版本中將「Open Source」標示爲了「Builder Qt」,致使PyQt中判斷錯誤,拋出許可不兼容的錯誤。將PyQt目錄中的configure.py添加以下行(搜索Common checks,2590行處),從新編譯便可。離線安裝的Qt5.5貌似沒有這個問題。spa

    # Common checks.
    #change by openthings@163.com.
    print("License:")
    print(introspecting)
    print(target_config.qt_licensee)
    print(ltype)
    target_config.qt_licensee = 'Open Source'
    #end change.

下面是完整的腳本:
code

#!/bin/sh
#Author:openthings@163.com.

#Install Qt5.5.
#Get online installer.
#wget http://download.qt.io/official_releases/online_installers/qt-unified-linux-x64-online.run
#chmod +x qt-unified-linux-x64-online.run

#Get offline installer.
#wget http://download.qt.io/official_releases/qt/5.5/5.5.0/qt-opensource-linux-x64-5.5.0-2.run
#chmod +x qt-opensource-linux-x64-5.5.0-2.run

#Add Qt Path to /etc/profile.
#sudo gedit /etc/profile
#add line: export PATH=$PATH:/home/userXXX/Qt/Qt5.5/gcc_64/bin

echo "Build PyQt.==============================================="
if [ ! -d "pyqt" ]; then
    mkdir pyqt
fi
cd pyqt

echo "Add OpenGL lib...========================================="
sudo apt-get install libgl1-mesa-dev

echo "Install SIP-4.16.9========================================"
if [ ! -f "sip-4.16.9.tar.gz" ]; then
wget http://www.riverbankcomputing.com/static/Downloads/sip4/sip-4.16.9.tar.gz
fi
if [ ! -d "sip-4.16.9" ]; then
    tar -vxf sip-4.16.9.tar.gz
fi

cd sip-4.16.9
python3 configure.py
make
sudo make install
cd ..

echo "Install PyQt-5.5=========================================="
if [ ! -f "PyQt-gpl-5.5.tar.gz" ]; then
wget http://www.riverbankcomputing.com/static/Downloads/PyQt5/PyQt-gpl-5.5.tar.gz
fi
if [ ! -d "PyQt-gpl-5.5" ]; then
    tar -vxf PyQt-gpl-5.5.tar.gz
fi

cd PyQt-gpl-5.5
cp ../../configure.py ./configure.py
python3 configure.py
make
sudo make install
cd ..

echo =========================================
echo QT5 and PyQT 5.5/SIP 4.16.9 Installed.
echo =========================================

Qt+Python已經開始成爲不少系統級軟件的標配了,Qt5.5的發佈改掉了之前的不少小毛病,基本上能夠放心地使用了。
ip

相關文章
相關標籤/搜索