Play the Raspberry Pi-raspberry and develop a custom interface using Python

Source: Internet
Author: User

1 Prepare SD card above 8G

During compilation, it consumes a lot of storage space and 4G is not enough.

2 Updating the index list of resources

sudo apt-get update (download index list from service) sudo apt-get upgrade (compare index list, update dependency)

3 Installing Python-dev

sudo apt-get install Python-dev

Otherwise, when you compile the SIP, you are prompted fatal error:python.h:no such file or directory

4 Installing Libqt4-dev

sudo apt-get install Libqt4-dev

Otherwise, when compiling pyqt, you will be prompted error:make sure you had a working Qt qmake on your PATH or use the-q argument to explicitly specify a work ing Qt qmake 5 installs SIP and PYQT in turn

wget Http://sourceforge.net/projects/pyqt/files/PyQt4/PyQt-4.10/PyQt-x11-gpl-4.10.tar.gztar VXF PYQT-X11-GPL-4.10.TAR.GZCD Pyqt-xll-gpl-4.10python Configure.pymakemake Install


5 running the Python&gui source code

Enter text in Qlineedit and the Qlabel will be displayed synchronously. The following chart is a two-day weekend outcome, although very humble, but the success of the moment, everything is worth it:).

-----------------------------to spit out the installation experience-----------------------------------------------------

Today, there is a project to do a self-running measurement system, thinking about how to implement automatic measurement when not connected to the PC. The previous day has been the Python GUI, so think of the idle raspberry Pi, perhaps with an HDMI monitor can be used. Friday, while playing games, while planning for the weekend to do something? The game is smooth, the mood is good. Think good Saturday, play Raspberry Pi, Sunday shopping (no shopping, time is not enough AH).

Saturday, early in the morning, did not eat breakfast, opened up, reformatted SD card, copy up Noobs v1.2.1. Boot installation system, one of the fool options, the last step to forget the choice of desktop or command line mode, the default command line, because do not know how to use the command to start desktop, and re-installed again, will friends please leave a message to guide, thank you.

----------Test python

Into the system,

First Enter

?

1 print ‘hello world‘

No problem.

One more.

?

0 S import math print ‘math.sin(3.14/2)‘


It's no problem.

------Trial Run code

So take a take for granted the Web disk downloaded, the previous days written GUI practice code. Run, the hint can not find Pyqt4.qtcore, Qtgui and so on, want to this machine Python no pyqt module, download PYQT tar.gz package, according to install, and no sip. OK, then download the SIP, install it, and also hint that python.h cannot be found. What's the matter, no clue, find the explanation of the netizen, oh, lack of development environment?

-------Install the Python development environment and sip(specifically what does it do?) )

?

1 sudo apt-get instyall python-dev

Python-dev installed after the good, sip.4.14.4 can be compiled,

------Install the QT4 Development Kit and PyQt

Cut to PyQt folder, Python configure.py, prompting for QT Qmake not found. This is how the matter, the Netizen said to install QT, that why say no qmake? Find a half-day answer, the original Qmake is included in the QT package, the general installation will bring, tried to install only qmake, useless (sudo apt-get install Qt4-qmake). Qt official website download that installation package can be large, how to do, because the use of Debian raspberry, search for a Debian Qt, find out if there is no source and the name of the installation package. Found the following address, Http://packages.debian.org/unstable/main/qt-sdk looked after a sudden cheerful, installed Libqt4-dev seems to be possible. Decisive sudo apt-get install Libqt4-dev. It seems to have found a resource bundle that can not be downloaded. Follow the prompts with sudo apt-get update, re-sudo apt-get install Libqt4-dev, the problem is resolved, the original resource index update obsolete. The first time, compile PYQT, midway Error stopped, restart the system, found only into command line mode, really let me at a loss. Fortunately, unplug the SD card, inserted in the notebook, accidentally found the SD card, basically full, so changed the 8G SD card, also re-verified the correctness of the process.


Play the Raspberry Pi-raspberry and develop a custom interface using Python

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.