首页 > 解决方案 > 如何使用 python 脚本将新目录创建到 SD 卡

问题描述

我需要在 SD 卡中设置树莓派。这就是为什么在将 raspberrypi 写入 SD 卡后,我需要在 /Volumes/boot 创建一个名为 ssh 的目录。为此我尝试了

os.mkdir("/Volumes/boot/ssh")

但它显示/Volumes/boot: No such file or directory但是,如果我在 python3 的控制台中编写相同的命令,而不是 python 脚本,它会完美运行。我也试过:

os.mkdir("/Volumes/boot/ssh")

但它也不起作用。那么,如何使用 python 脚本在我的 SD 卡中创建 /Volumes/boot/ssh 这个文件夹?

标签: pythonsd-cardmkdir

解决方案


推荐阅读