2024-10-04 03:17:06 发布
网友
正在尝试运行一个启动Raspberry Pi相机的文件。 我可以很容易地做到
cd dir
然后呢
./start.sh
所以我尝试用Python代码运行它:
os.system("~/RosPi_Cam_Web_Interface/start.sh")
但它说找不到这个方向。 我做错什么了? 如何更好地使用子流程来实现呢?在
~由shell展开。您必须调用os.path.expanduser将其扩展到主目录:
~
os.path.expanduser
import os.path import system os.system(os.path.expanduser("~/RosPi_Cam_Web_Interface/start.sh"))
~
由shell展开。您必须调用os.path.expanduser
将其扩展到主目录:相关问题 更多 >
编程相关推荐