原理没去倒腾,一般遇到这个问题可以参考这篇文章https://blog.csdn.net/JineD/article/details/124774570
以利用豆瓣镜像网安装某个包为例:pip install sklearn -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com
已经给出--trusted-host http://pypi.douban.com命令了,但却出现了 ERROR: To modify pip, please run the following command: D:\Python\xxx\python.exe -m pip install --upgrade pip -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com 这个提示,那么按它说的去运行这个名就可以了。找到你Python安装的位置,用exe程序加-m去执行之前的命令即可。