可以的。Debian 完全可以运行 Python 脚本,而且大多数 Debian 系统本身就自带 Python。
在终端中执行:
python3 --version
如果显示类似 Python 3.11.2 的版本号,说明已经安装。
如果没有安装,可以用 apt 安装:
sudo apt update
sudo apt install python3
例如创建 hello.py:
print("Hello Debian")
方式一:直接用 python3 运行
python3 hello.py
方式二:作为可执行脚本运行 在脚本第一行加上:
#!/usr/bin/env python3
然后赋予执行权限:
chmod +x hello.py
./hello.py
python 命令(这是正常的)pip3 安装第三方库:sudo apt install python3-pip
pip3 install requests
如果你有具体需求(比如开机自启、定时任务、虚拟环境、GUI 脚本等),我可以继续帮你说明。