Docker/系统运维

pip安装报403错误 解决方法

daimafengzi · 7月10日 · 2023年 · 本文共1357个字 · 预计阅读5分钟20017次已读

问题

使用清华源(https://pypi.tuna.tsinghua.edu.cnpip安装报403错误

ERROR: HTTP error 403 while getting https://pypi.tuna.tsinghua.edu.cn/packages/16/18/9726cac3c7cb9e5a1ac4523b3e508128136b37aadb3462c857a19318900e/Flask-BasicAuth-0.2.0.tar.gz#sha256=df5ebd489dc0914c224419da059d991eb72988a01cdd4b956d52932ce7d501ff (from https://pypi.tuna.tsinghua.edu.cn/simple/flask-basicauth/)
ERROR: Could not install requirement Flask-BasicAuth>=0.2.0 from https://pypi.tuna.tsinghua.edu.cn/packages/16/18/9726cac3c7cb9e5a1ac4523b3e508128136b37aadb3462c857a19318900e/Flask-BasicAuth-0.2.0.tar.gz#sha256=df5ebd489dc0914c224419da059d991eb72988a01cdd4b956d52932ce7d501ff (from locust) because of HTTP error 403 Client Error: Forbidden for url: https://pypi.tuna.tsinghua.edu.cn/packages/16/18/9726cac3c7cb9e5a1ac4523b3e508128136b37aadb3462c857a19318900e/Flask-BasicAuth-0.2.0.tar.gz for URL https://pypi.tuna.tsinghua.edu.cn/packages/16/18/9726cac3c7cb9e5a1ac4523b3e508128136b37aadb3462c857a19318900e/Flask-BasicAuth-0.2.0.tar.gz#sha256=df5ebd489dc0914c224419da059d991eb72988a01cdd4b956d52932ce7d501ff (from https://pypi.tuna.tsinghua.edu.cn/simple/flask-basicauth/)

这是因为 PyPI 禁用了对 API 的非 HTTPS 访问
https://mail.python.org/pipermail/distutils-sig/2017-October/031712.html

解决方法

将安装源换成 https://pypi.python.org/simple/

pip install xxxx -i https://pypi.python.org/simple/

整个docker换源

更换docker容器里的pip源。https://www.daimafengzi.ml/archives/166.html

0 条回应
| 耗时 0.511 秒 | 查询 59 次 | 内存 4.21 MB |
本站CDN由One degree CDN提供