python 如何检查您的Raspberry Pi版本

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python 如何检查您的Raspberry Pi版本相关的知识,希望对你有一定的参考价值。

cat /proc/cpuinfo

```
  Hardware	: BCM2708
  Revision	: 000f
```

These are the known revision up to Q4 2014.

 -Revision	Release Date	Model	PCB Revision	Memory	Notes
 -Beta	Q1 2012	B (Beta)	 ?	256MB	Beta Board
 -0002	Q1 2012	B	1.0	256MB	
 -0003	Q3 2012	B (ECN0001)	1.0	256MB	Fuses mod and D14 removed
 -0004	Q3 2012	B	2.0	256MB	(Mfg by Sony)
 -0005	Q4 2012	B	2.0	256MB	(Mfg by Qisda)
 -0006	Q4 2012	B	2.0	256MB	(Mfg by Egoman)
 -0007	Q1 2013	A	2.0	256MB	(Mfg by Egoman)
 -0008	Q1 2013	A	2.0	256MB	(Mfg by Sony)
 -0009	Q1 2013	A	2.0	256MB	(Mfg by Qisda)
 -000d	Q4 2012	B	2.0	512MB	(Mfg by Egoman)
 -000e	Q4 2012	B	2.0	512MB	(Mfg by Sony)
 -000f	Q4 2012	B	2.0	512MB	(Mfg by Qisda)
 -0010	Q3 2014	B+	1.0	512MB	(Mfg by Sony)
 -0011	Q2 2014	Compute Module	1.0	512MB	(Mfg by Sony)
 
 or execute:  `sudo python ports.py`

import RPi.GPIO as GPIO
if GPIO.RPI_REVISION == 1:
    ports = [0, 1, 21]
else:
    ports = [2, 3, 27]
print "Your Pi is a Revision %s, so your ports are: %s" % (GPIO.RPI_REVISION, ports)

以上是关于python 如何检查您的Raspberry Pi版本的主要内容,如果未能解决你的问题,请参考以下文章