玩转树莓派-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方式运行。

    下面这张图是周末两天的成果,虽然说非常简陋,但运行成功的一刻,一切都值得了:)。

相关文章
相关标签/搜索