由于自身调试 OIDC 需要,写了一个懒猫 ENV 查看器,然后发到商店里给大家使用/
打包的时候偷了个懒,直接打包的没有用容器,然后其中一位用户就遇到这个问题:

要了下日志,结果是发现访问清华源有问题,被清华源直接返回了 403,这个问题还比较稀奇,毕竟在我的印象里清华源一直都很稳。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
| -------------logs:------------- app-1 | 2025-06-23T14:28:36.813573986Z Start Child Process: [sh -c ./lzcapp/pkg/content/run.sh] app-1 | 2025-06-23T14:28:36.813587080Z PATH:"/" is served by "exec"://"5005,./lzcapp/pkg/content/run.sh" app-1 | 2025-06-23T14:28:36.818585835Z fetch https://mirrors.ustc.edu.cn/alpine/v3.20/main/x86_64/APKINDEX.tar.gz app-1 | 2025-06-23T14:28:36.997192042Z fetch https://mirrors.ustc.edu.cn/alpine/v3.20/community/x86_64/APKINDEX.tar.gz app-1 | 2025-06-23T14:28:37.251288967Z 2025/06/23 22:28:37 http: proxy error: dial tcp 127.0.0.1:5005: connect: connection refused app-1 | 2025-06-23T14:28:37.251446934Z 2025/06/23 22:28:37 http: proxy error: dial tcp 127.0.0.1:5005: connect: connection refused app-1 | 2025-06-23T14:28:37.444530406Z v3.20.6-201-gd57c9d7d1c9 [https://mirrors.ustc.edu.cn/alpine/v3.20/main] app-1 | 2025-06-23T14:28:37.444552892Z v3.20.6-203-g66ce3a1d0dc [https://mirrors.ustc.edu.cn/alpine/v3.20/community] app-1 | 2025-06-23T14:28:37.444560548Z OK: 24177 distinct packages available app-1 | 2025-06-23T14:28:37.732800630Z (1/25) Installing libbz2 (1.0.8-r6) app-1 | 2025-06-23T14:28:37.834399822Z (2/25) Installing libexpat (2.7.0-r0) app-1 | 2025-06-23T14:28:37.978333761Z (3/25) Installing libffi (3.4.6-r0) app-1 | 2025-06-23T14:28:37.996681317Z (4/25) Installing gdbm (1.23-r1) app-1 | 2025-06-23T14:28:38.023808099Z (5/25) Installing xz-libs (5.6.2-r1) app-1 | 2025-06-23T14:28:38.059202322Z (6/25) Installing libgcc (13.2.1_git20240309-r1) app-1 | 2025-06-23T14:28:38.120270779Z (7/25) Installing libstdc++ (13.2.1_git20240309-r1) app-1 | 2025-06-23T14:28:38.219766620Z (8/25) Installing mpdecimal (4.0.0-r0) app-1 | 2025-06-23T14:28:38.244870690Z (9/25) Installing ncurses-terminfo-base (6.4_p20240420-r2) app-1 | 2025-06-23T14:28:38.266752323Z (10/25) Installing libncursesw (6.4_p20240420-r2) app-1 | 2025-06-23T14:28:38.301269438Z (11/25) Installing libpanelw (6.4_p20240420-r2) app-1 | 2025-06-23T14:28:38.318329841Z (12/25) Installing readline (8.2.10-r0) app-1 | 2025-06-23T14:28:38.474049984Z (13/25) Installing sqlite-libs (3.45.3-r2) app-1 | 2025-06-23T14:28:38.628199528Z (14/25) Installing python3 (3.12.11-r0) app-1 | 2025-06-23T14:28:39.316803498Z WAIT ./lzcapp/pkg/content/run.sh 127.0.0.1:5005 ERR: dial tcp 127.0.0.1:5005: connect: connection refused app-1 | 2025-06-23T14:28:39.367766399Z (15/25) Installing python3-pycache-pyc0 (3.12.11-r0) app-1 | 2025-06-23T14:28:39.753346082Z (16/25) Installing pyc (3.12.11-r0) app-1 | 2025-06-23T14:28:39.770701744Z (17/25) Installing py3-setuptools-pyc (70.3.0-r0) app-1 | 2025-06-23T14:28:39.929343816Z (18/25) Installing py3-pip-pyc (24.0-r2) app-1 | 2025-06-23T14:28:40.207250136Z (19/25) Installing py3-parsing (3.1.2-r1) app-1 | 2025-06-23T14:28:40.304655931Z (20/25) Installing py3-parsing-pyc (3.1.2-r1) app-1 | 2025-06-23T14:28:40.317188019Z WAIT ./lzcapp/pkg/content/run.sh 127.0.0.1:5005 ERR: dial tcp 127.0.0.1:5005: connect: connection refused app-1 | 2025-06-23T14:28:40.529573664Z (21/25) Installing py3-packaging-pyc (24.0-r1) app-1 | 2025-06-23T14:28:40.618998893Z (22/25) Installing python3-pyc (3.12.11-r0) app-1 | 2025-06-23T14:28:40.653772503Z (23/25) Installing py3-packaging (24.0-r1) app-1 | 2025-06-23T14:28:40.830130888Z (24/25) Installing py3-setuptools (70.3.0-r0) app-1 | 2025-06-23T14:28:40.995056226Z (25/25) Installing py3-pip (24.0-r2) app-1 | 2025-06-23T14:28:41.318293072Z WAIT ./lzcapp/pkg/content/run.sh 127.0.0.1:5005 ERR: dial tcp 127.0.0.1:5005: connect: connection refused app-1 | 2025-06-23T14:28:41.764687778Z Executing busybox-1.36.1-r29.trigger app-1 | 2025-06-23T14:28:41.768553945Z OK: 75 MiB in 42 packages app-1 | 2025-06-23T14:28:42.318842615Z WAIT ./lzcapp/pkg/content/run.sh 127.0.0.1:5005 ERR: dial tcp 127.0.0.1:5005: connect: connection refused app-1 | 2025-06-23T14:28:42.994899875Z Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple app-1 | 2025-06-23T14:28:43.192401924Z Collecting Flask (from -r ./requirements.txt (line 1)) app-1 | 2025-06-23T14:28:43.219653783Z ERROR: HTTP error 403 while getting https://pypi.tuna.tsinghua.edu.cn/packages/3d/68/9d4508e893976286d2ead7f8f571314af6c2037af34853a30fd769c02e9d/flask-3.1.1-py3-none-any.whl (from https://pypi.tuna.tsinghua.edu.cn/simple/flask/) (requires-python:>=3.9) app-1 | 2025-06-23T14:28:43.219966823Z ERROR: Could not install requirement Flask from https://pypi.tuna.tsinghua.edu.cn/packages/3d/68/9d4508e893976286d2ead7f8f571314af6c2037af34853a30fd769c02e9d/flask-3.1.1-py3-none-any.whl (from -r ./requirements.txt (line 1)) because of HTTP error 403 Client Error: Forbidden for url: https://pypi.tuna.tsinghua.edu.cn/packages/3d/68/9d4508e893976286d2ead7f8f571314af6c2037af34853a30fd769c02e9d/flask-3.1.1-py3-none-any.whl for URL https://pypi.tuna.tsinghua.edu.cn/packages/3d/68/9d4508e893976286d2ead7f8f571314af6c2037af34853a30fd769c02e9d/flask-3.1.1-py3-none-any.whl (from https://pypi.tuna.tsinghua.edu.cn/simple/flask/) (requires-python:>=3.9) app-1 | 2025-06-23T14:28:43.319551942Z WAIT ./lzcapp/pkg/content/run.sh 127.0.0.1:5005 ERR: dial tcp 127.0.0.1:5005: connect: connection refused app-1 | 2025-06-23T14:28:43.578023168Z Traceback (most recent call last): app-1 | 2025-06-23T14:28:43.578037493Z File "/lzcapp/pkg/content/app.py", line 2, in <module> app-1 | 2025-06-23T14:28:43.578038656Z from flask import Flask, request, render_template app-1 | 2025-06-23T14:28:43.578039625Z ModuleNotFoundError: No module named 'flask' app-1 | 2025-06-23T14:28:43.581234895Z ChildProcess exit: exit status 1 app-1 | 2025-06-23T14:28:44.320074235Z WAIT ./lzcapp/pkg/content/run.sh 127.0.0.1:5005 ERR: dial tcp 127.0.0.1:5005: connect: connection refused app-1 | 2025-06-23T14:28:45.320738420Z WAIT ./lzcapp/pkg/content/run.sh 127.0.0.1:5005 ERR: dial tcp 127.0.0.1:5005: connect: connection refused app-1 | 2025-06-23T14:28:46.321124378Z WAIT ./lzcapp/pkg/content/run.sh 127.0.0.1:5005 ERR: dial tcp 127.0.0.1:5005: connect: connection refused app-1 | 2025-06-23T14:28:47.322143472Z WAIT ./lzcapp/pkg/content/run.sh 127.0.0.1:5005 ERR: dial tcp 127.0.0.1:5005: connect: connection refused app-1 | 2025-06-23T14:28:48.322911993Z WAIT ./lzcapp/pkg/content/run.sh 127.0.0.1:5005 ERR: dial tcp 127.0.0.1:5005: connect: connection refused app-1 | 2025-06-23T14:28:49.323128356Z WAIT ./lzcapp/pkg/content/run.sh 127.0.0.1:5005 ERR: dial tcp 127.0.0.1:5005: connect: connection refused app-1 | 2025-06-23T14:28:50.323783719Z WAIT ./lzcapp/pkg/content/run.sh 127.0.0.1:5005 ERR: dial tcp 127.0.0.1:5005: connect: connection refused app-1 | 2025-06-23T14:28:51.323982245Z WAIT ./lzcapp/pkg/content/run.sh 127.0.0.1:5005 ERR: dial tcp 127.0.0.1:5005: connect: connection refused app-1 | 2025-06-23T14:28:52.324934294Z WAIT ./lzcapp/pkg/content/run.sh 127.0.0.1:5005 ERR: dial tcp 127.0.0.1:5005: connect: connection refused app-1 | 2025-06-23T14:28:53.325225164Z WAIT ./lzcapp/pkg/content/run.sh 127.0.0.1:5005 ERR: dial tcp 127.0.0.1:5005: connect: connection refused app-1 | 2025-06-23T14:28:54.325889637Z WAIT ./lzcapp/pkg/content/run.sh 127.0.0.1:5005 ERR: dial tcp 127.0.0.1:5005: connect: connection refused app-1 | 2025-06-23T14:28:55.326592221Z WAIT ./lzcapp/pkg/content/run.sh 127.0.0.1:5005 ERR: dial tcp 127.0.0.1:5005: connect: connection refused app-1 | 2025-06-23T14:28:56.326903845Z WAIT ./lzcapp/pkg/content/run.sh 127.0.0.1:5005 ERR: dial tcp 127.0.0.1:5005: connect: connection refused app-1 | 2025-06-23T14:28:57.327197993Z WAIT ./lzcapp/pkg/content/run.sh 127.0.0.1:5005 ERR: dial tcp 127.0.0.1:5005: connect: connection refused app-1 | 2025-06-23T14:28:58.327666585Z WAIT ./lzcapp/pkg/content/run.sh 127.0.0.1:5005 ERR: dial tcp 127.0.0.1:5005: connect: connection refused
|
GPT 查询了下,可能就是 IP 给限制了。

打开清华的 Pypi 的页面,看到这位的 IP 确实被清华拦截了。

为了防止这个情况,有两个办法:
- 直接使用 Docker 做好镜像,这样就无关软件源
- 可以同时设置其他 pypi 源:
1
| pip config set global.extra-index-url "https://mirrors.aliyun.com/pypi/simple/ https://repo.huaweicloud.com/repository/pypi/simple/ https://mirrors.cloud.tencent.com/pypi/simple/"
|
然后可以使用 pip config list 查看,能看到我这个是走了腾讯云的:
1 2 3 4 5 6 7 8 9 10 11
| pip install pandas Looking in indexes: https://pypi.org/simple, https://mirrors.aliyun.com/pypi/simple/, https://repo.huaweicloud.com/repository/pypi/simple/, https://mirrors.cloud.tencent.com/pypi/simple/ Collecting pandas Downloading https://mirrors.cloud.tencent.com/pypi/packages/9f/cc/ae8ea3b800757a70c9fdccc68b67dc0280a6e814efcf74e4211fd5dea1ca/pandas-2.3.0-cp312-cp312-macosx_11_0_arm64.whl (10.7 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 10.7/10.7 MB 3.6 MB/s eta 0:00:00 Requirement already satisfied: numpy>=1.26.0 in /opt/miniconda3/lib/python3.12/site-packages (from pandas) (1.26.4) Requirement already satisfied: python-dateutil>=2.8.2 in /opt/miniconda3/lib/python3.12/site-packages (from pandas) (2.9.0.post0) Requirement already satisfied: pytz>=2020.1 in /opt/miniconda3/lib/python3.12/site-packages (from pandas) (2025.1) Requirement already satisfied: tzdata>=2022.7 in /opt/miniconda3/lib/python3.12/site-packages (from pandas) (2025.1) Requirement already satisfied: six>=1.5 in /opt/miniconda3/lib/python3.12/site-packages (from python-dateutil>=2.8.2->pandas) (1.17.0) Installing collected packages: pandas
|