临时修改pypi镜像源方法:
转移到国内源地址:
阿里云 http://mirrors.aliyun.com/pypi/simple/
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
豆瓣(douban) http://pypi.douban.com/simple/
清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/
中国科学技术大学 http://pypi.mirrors.ustc.edu.cn/simple/
安装时候指定国内源:
pip install pkg_name(包名) -i http://pypi.douban.com/simple/
当你遇到这样的问题的时候(没有就跳过)
pypi.douban.com is not a trusted or secure host and is being ignored.
解决办法需要加信任:
pip install pkg_name(包名) -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com
永久修改pypi镜像源方法:
-
在C盘中找到目录: C:\Users\用户名\AppData\Roaming
-
查看在Roaming文件夹下新建pip文件夹(如果已经存在就跳过此步)
-
在pip文件夹中创建一个pip.ini文件
-
使用记事本的方式打开pip.ini文件,写入:
[global]
index-url=http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host=mirrors.aliyun.com
或者
[global]
timeout = 6000
index-url = http://pypi.douban.com/simple/
trusted-host = pypi.douban.com
然后就可以了