玩轉樹莓派-RaspBerry,使用Python開發定製界面

1 準備SD卡8G以上,16G更佳。python

    編譯過程當中,會耗用大量存儲空間。必定在編譯以前運行sudo raspi-config,選擇expand file system擴展SD卡的分區。shell

    若是空間不夠,會致使運行掛起。使用df -h可查看存儲卡的可用容量。
spa

2 更新資源的索引清單.net

sudo apt-get update (從服務上下載索引清單)
sudo apt-get upgrade (比較索引清單,更新依賴關係)

3 安裝 python-devcode

sudo apt-get install python-dev

    不然在編譯SIP時,會提示 fatal error: Python.h: No such file or directory索引

4 安裝libqt4-devip

sudo apt-get install libqt4-dev
#或者
sudo apt-get install qt4-dev-tools

    不然在編譯PyQt時會提示 Error:Make sure you have a working Qt qmake on your PATH or use the -q argument to explicitly specify a working Qt qmake 5。
ci

    依次安裝SIP和PyQt。資源

    安裝SIP:
get

wget http://sourceforge.net/projects/pyqt/files/sip/sip-4.16.6/sip-4.16.6.tar.gz
tar vxf sip-4.16.6.tar.gz
cd sip-4.16.6
python configure.py
make
make install

    安裝PyQt4:

#wget http://sourceforge.net/projects/pyqt/files/PyQt4/PyQt-4.10/PyQt-x11-gpl-4.10.tar.gz
wget http://sourceforge.net/projects/pyqt/files/PyQt4/PyQt-4.10.4/PyQt-x11-gpl-4.10.4.tar.gz/download
cp download PyQt-x11-gpl-4.10.4.tar.gz  
tar vxf PyQt-x11-gpl-4.10.4tar.gz
cd PyQt-xll-gpl-4.10.4
python configure.py
make
make install


5 運行Python&GUI的源代碼

    進入PyQT下面的Examples目錄,使用python *.py方式運行。

    下面這張圖是週末兩天的成果,雖然說非常簡陋,但運行成功的一刻,一切都值得了:)。

相關文章
相關標籤/搜索