0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

raspberry pi でPythonを自動起動させたいんや!!!

Last updated at Posted at 2021-11-12

タイトルのとおりです。

sudo chmod 755 hello.py
sudo nano /etc/rc.local
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
  printf "My IP address is %s\n" "$_IP"
fi

python3 /home/pi/Desktop/hello.py 

他の処理

他の処理

exit 0
sudo reboot

はい、これだけ

他の記事を見ていると

python3 /home/pi/Desktop/hello.py &

と書かれているが、

&をなくしたら動いた。

なんでか分からん。

Bootをネットワークにしてたが、Desktopに変えても動いた。
まずはこの形で試してみるほうが差表が少なくていいかもしれない。

2021/12/02追記

シンプルにコードのミスで動いてなかった?
ループするコードなら&は書いておいた方が良い。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?