fix: pip 镜像失败时自动回退并提示代理
EOF Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+45
-2
@@ -295,7 +295,50 @@ sudo bash deploy/update.sh
|
||||
|
||||
---
|
||||
|
||||
## 10. 更新后无法访问(连接被拒绝)
|
||||
## 10. pip 安装失败(No matching distribution / from versions: none)
|
||||
|
||||
若 `install.sh` / `update.sh` 在安装 Python 依赖时报:
|
||||
|
||||
```text
|
||||
ERROR: Could not find a version that satisfies the requirement fastapi==0.115.6 (from versions: none)
|
||||
ERROR: No matching distribution found for fastapi==0.115.6
|
||||
```
|
||||
|
||||
说明 **pip 根本拉不到 PyPI 索引**(网络/代理问题),不是版本号写错。
|
||||
|
||||
在服务器上排查:
|
||||
|
||||
```bash
|
||||
curl -I https://pypi.tuna.tsinghua.edu.cn/simple/fastapi/
|
||||
curl -I https://mirrors.aliyun.com/pypi/simple/fastapi/
|
||||
```
|
||||
|
||||
处理方式(任选其一后重新安装):
|
||||
|
||||
```bash
|
||||
# 方式 A:走代理后再装(代理地址按实际修改)
|
||||
export http_proxy=http://192.168.8.246:10810
|
||||
export https_proxy=http://192.168.8.246:10810
|
||||
export HTTP_PROXY="$http_proxy"
|
||||
export HTTPS_PROXY="$https_proxy"
|
||||
cd /opt/secondary-school-grade-archive
|
||||
sudo -E bash deploy/install.sh
|
||||
|
||||
# 方式 B:换国内镜像
|
||||
export PIP_MIRROR=https://mirrors.aliyun.com/pypi/simple
|
||||
cd /opt/secondary-school-grade-archive/backend
|
||||
source venv/bin/activate
|
||||
pip install -r requirements.txt -i "$PIP_MIRROR" --trusted-host mirrors.aliyun.com
|
||||
deactivate
|
||||
# 依赖装好后继续跑完安装(或再执行 install.sh)
|
||||
sudo -E bash /opt/secondary-school-grade-archive/deploy/install.sh
|
||||
```
|
||||
|
||||
当前脚本会自动尝试多个镜像;仍失败时请先保证服务器能访问上述 URL。
|
||||
|
||||
---
|
||||
|
||||
## 11. 更新后无法访问(连接被拒绝)
|
||||
|
||||
若浏览器提示 **ERR_CONNECTION_REFUSED**,通常是 `update.sh` 停止了旧 PM2,但 **systemd 服务未成功启动**。
|
||||
|
||||
@@ -319,6 +362,6 @@ ss -tlnp | grep 23566
|
||||
|
||||
---
|
||||
|
||||
## 11. 技术支持
|
||||
## 12. 技术支持
|
||||
|
||||
微信 **dekun03** · 手机 **18364911125**
|
||||
|
||||
Reference in New Issue
Block a user