SoFunction
Updated on 2025-03-10

python Tsinghua pip mirror source report HTTP error 403 error solution

Error message

 ERROR: HTTP error 403 while getting /pypi/web/packages/52/79/a64937a2185b91a96cc5406e3ea58120980c725543d047e112fb3084a972/fake_useragent-2.0. (from /pypi/web/simple/fake-useragent/)

Solution

Method 1:

Temporarily change the mirror source (Ali mirror source)

Replace the package with the package you need to install

pip install -i /pypi/simple Package --trusted-host 

Method 2

Permanently replace the source (Ali mirror source)

pip config set -url /pypi/simple
pip config set -host 

Method 3

Configure multiple mirror sources (the default mirror source is set after Method 2, where multiple mirror sources balance the load, namely Tsinghua University Source and Douban Source)

pip config set -index-url "/simple /simple"

Configure multiple trusted hosts (domain names), namely Alibaba, Tsinghua University, and Douban mirror domain names

pip config set -host "  "

Finally, clear the cache and take effect in time(Method 2 and method 3 are used)

pip cache purge

Summarize

This is the article about the problem of solving the HTTP error 403 error in python Tsinghua pip mirror source report. For more related content in Tsinghua pip mirror source report, please search for my previous article or continue browsing the related articles below. I hope everyone will support me in the future!