1、创建 test 文件夹
mkdir test
2、进入 test 文件夹
cd test
3、 创建 test_venv_name 虚拟环境
python -m venv test_venv_name
4、 激活/退出虚拟环境
source test_venv_name/bin/activate
deactivate
5、显示 pip 工具的版本信息
python3 -m pip --version
6、 使用 pip 安装requirements.txt 依赖项
pip install -r requirements.txt
requirements.txt格式为 "Python package==version",需要指定url时,使用"-f url"
torch==2.1.2+cu118
-f https://download.pytorch.org/whl/torch_stable.html
7、赋予 test.py 执行权限
chmod +x test.py
8、后台运行 test.py ,重定向输出至 test.out
nohup python3 test.py > test.out 2>&1 &
9、 查找特定进程信息
ps -ef | grep 111111
10、强制终止进程
kill -9 111111
11、显示磁盘空间使用情况
df -h ~/test/
du -h ~/test/