赞
踩
参考 https://blog.csdn.net/qq_38288618/article/details/104096606
import time
c=1
while 1:
time.sleep(1)
c=c+1
print(c)
运行
sudo chmod 777 test.py
python3 test.py
#!/bin/bash
gnome-terminal -x bash -c "sleep 25;cd /home/me/robot/;python3 test.py"
注意:脚本需要实现开放执行权限 sudo chmod 777 run.sh


点击add

Name:定义名字,test
Command:gnome-terminal -x sh /home/robot/run.sh
#其中gnome-terminal为开机打开终端。
sh /home/robot/run.sh 运行脚本。
Comment:说明,随意填写,可不填。
点击保存。
编程成的可执行文件为test
与python相似,只是自启动脚本里面启动方式为./test
#!/bin/bash
gnome-terminal -x bash -c "sleep 25;cd /home/me/robot/;./test"
参考 https://blog.csdn.net/zkk9527/article/details/111353428
报错为:
Module compiled against API version 0xa but this version of numpy is 0x9
Module compiled against API version 0xa but this version of numpy is 0x9
Traceback (most recent call last):
File "<stdin>", line 4, in <module>
ImportError: No module named rospy
启动包含rospy的python代码前,添加source /opt/ros/kinetic/setup.bash
#!/bin/bash
gnome-terminal -x bash -c "sleep 30;source /opt/ros/kinetic/setup.bash;cd /home/robot/;python3 test.py"
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。