Python 部署
Python 部署
安装环境
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# 更新软件包列表
sudo apt update && sudo apt upgrade -y
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
# 安装 Python 3 和 pip
sudo apt install -y python3.12
python3.12 --version
# 安装 UV
curl -LsSf https://astral.sh/uv/install.sh | sh
# 创建虚拟环境
uv venv
# 激活虚拟环境
source .venv/bin/activate
# 同步依赖
uv sync --index-url https://pypi.tuna.tsinghua.edu.cn/simple
# 启动后台运行
pm2 start ecosystem.config.js
Redis 部署
1
2
3
4
5
6
7
8
# 安装
sudo apt install redis-server
# 检查状态
sudo systemctl status redis-server
# 手动启动
sudo systemctl start redis-server
# 开机启动
sudo systemctl enable redis-server
This post is licensed under
CC BY 4.0
by the author.