在腳本首行添加: #! /usr/bin/env python3 然后更改腳本的模式為可執(zhí)行,并把權限給當前用戶,: sudo chmod u+x main.py 然后在shell中直接輸入 ./main.py即可運行腳本