win更换pip源到国内镜像
pip国内的一些镜像:
清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/
阿里云 http://mirrors.aliyun.com/pypi/simple/
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
豆瓣 http://pypi.douban.com/simple/
中国科学技术大学 http://pypi.mirrors.ustc.edu.cn/simple/
华中理工大学 http://pypi.hustunique.com/
山东理工大学 http://pypi.sdutlinux.org/
临时使用方法:
在使用pip的时候加上参数-i,并指定pip源
例如:pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pandas
这样就会从清华这边的镜像去安装pandas库
永久使用方法:
1.打开appdata文件夹
这个文件夹一般情况下是被默认隐藏了,可以用win+R然后输入appdata
2.在Roaming文件夹里新建pip文件夹
3.新建之后,在pip文件夹里新建文本文档,名字为pip,文档内容为:
[global]
timeout = 6000
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
trusted-host = pypi.tuna.tsinghua.edu.cn
这里的网址根据镜像源的不同可以更换
4.修改txt文件为ini格式
5.win+r尝试pip install some-package
有些电脑win+r之后pip无法输入,那就在jupyter notebook里用pip install一个新的package,一般情况下会出现镜像源地址,看是否修改成功
txt格式改为ini格式:
文件夹选项-查看中去除"隐藏已知文件类型的扩展名",确定.
右击文件-重命名,将TXT格式改为INI格式.