raspberrypi 開機自動執行程式 與 在terminal開啟第二個terminal執行python

raspberrypi 開啟另一個terminal執行程式


在terminal輸入:
lxterminal -e python3 demo.py



參考自:https://www.raspberrypi.org/forums/viewtopic.php?t=65607

-------------------------------------------------------------------------------------------------------------------------------------------------------



raspberrypi 開機自動執行程式

在terminal中輸入以下指令,開啟檔案:
sudo nano /etc/rc.local


以下是加入執行python程式
  1. #!/bin/sh -e
  2. #
  3. # rc.local
  4. #
  5. # This script is executed at the end of each multiuser runlevel.
  6. # Make sure that the script will "exit 0" on success or any other
  7. # value on error.
  8. #
  9. # In order to enable or disable this script just change the execution
  10. # bits.
  11. #
  12. # By default this script does nothing.
  13.  
  14. # Print the IP address _IP=$(hostname -I) || true
  15. if [ "$_IP" ]; then
  16.    printf "My IP address is %s\n" "$_IP"
  17. fi
  18.  
  19. sudo python /home/pi/demo.py  <==加入在這邊
  20.  
  21. exit 0

參考自:http://dirtypig8.blogspot.tw/2016/12/python.html#!/tcmbck

留言

這個網誌中的熱門文章

python nn 聲音辨識 -1 傅立葉轉換

android 定時通知(永久長期的) 本篇只講AlarmManager使用

C# 模擬鍵盤滑鼠控制電腦

python pyautogui 簡介