-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpython-guide
50 lines (41 loc) · 1.13 KB
/
python-guide
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# Guide for python installation for Raspbian 11 (bulsseye)
sudo apt update
sudo apt install libc6-dev libcap2 libcap-dev
sudo adduser $USER kmem
echo 'SUBSYSTEM=="mem", KERNEL=="mem", GROUP="kmem", MODE="0660"' | sudo tee /etc/udev/rules.d/98-mem.rules
sudo reboot
sudo apt install python3-pip
pip3 install pillow
pip3 install numpy
sudo apt install libopenjp2-7
sudo apt install libtiff5
sudo apt install libatlas-base-dev
pip3 install RPi.GPIO
pip3 install smbus
cd
sudo apt install p7zip-full
wget https://www.waveshare.com/w/upload/0/06/Fan_HAT.7z
7z x Fan_HAT.7z -r -o./Fan_HAT
cd Fan_HAT/python/
python3 main.py
# A systemd unit
sudo vi /etc/systemd/system/pwm-led.service
# Paste the below, save and quit
[Unit]
Description=pwm-led
After=network-online.target
Wants=network-online.target
[Service]
ExecStart=/usr/bin/python3 -u main.py
WorkingDirectory=/home/pi/Fan_HAT/python/
StandardOutput=inherit
StandardError=inherit
Restart=always
User=pi
[Install]
WantedBy=multi-user.target
# At the end reload the daemon , enable and start the service
sudo systemctl daemon-reload
sudo systemctl enable pwm-led.service
#Restart Raspberry
sudo reboot