Jupyter安装第三方库和切换pip镜像源

# JJU_干干

 

1. 在Jupyter中安装第三方库和在本地安装类似,区别在于,Jupyter要在开头加一个感叹号。

  

!pip install 某包

2. 但这样往往下载较慢或者出现错误(以 lightgbm 为例):

  

  因此我们需要切换国内的镜像源更快速方便的下载,类似于本地切换镜像源类似,也是开头多加一个感叹号。

  以安装 lightgbm,切换清华源为例:

  

 

代码例子:

! pip install lightgbm -i https://pypi.tuna.tsinghua.edu.cn/simple

代码形式:

! pip install 某包 -i 某镜像源

国内常用的镜像源:

清华大学: https://pypi.tuna.tsinghua.edu.cn/simple/
阿里云: https://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/simple/
山东理工大学:http://pypi.sdutlinux.org/simple/

 

posted @ 2020-06-05 22:13  ZengZG  Views(4707)  Comments(0Edit  收藏  举报