编程日志 | nohup.net

实践是检验真理的唯一标准

pip设置国内镜像源

PIP设置镜像源
pip安装Python包时候,默认是国外的下载源,速度太慢,本文介绍几种设置pip国内镜像源的方法

镜像源
阿里云

http://mirrors.aliyun.com/pypi/simple/
清华大学

https://pypi.tuna.tsinghua.edu.cn/simple/
中国科技大学

https://pypi.mirrors.ustc.edu.cn/simple/
中国科学技术大学

http://pypi.mirrors.ustc.edu.cn/simple/
豆瓣

https://pypi.douban.com/simple/
备注:若出现问题,可尝试使用https协议。

1 命令法
格式:pip install numpy -i https://pypi.douban.com/simple/

pip install numpy -i https://pypi.douban.com/simple/
这个是使用豆瓣源来安装numpy

pip执行时要注意pip的路径已加入环境变量,可被搜索到执行,如果没有需要进入pip当前的目录进行运行

2 设置默认值法
设为默认值可以一劳永逸的解决使用命令行的麻烦

pip install pip -U
pip config set global.index-url https://pypi.douban.com/simple/
备注:如果是pip3,则命令前面的pip要改为pip3


安装的时候加上参数:

--trusted-host pypi.douban.com


from:

https://blog.csdn.net/ghost55565/article/details/119322647


Powered By Z-BlogPHP 1.7.2

© 2013-2022 nohup.net , All Rights Reserved. 豫ICP备20020372号-1