-
pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple 包名 -
例如: -
pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple pandas
国内源:
清华:https://pypi.tuna.tsinghua.edu.cn/simple
阿里云:http://mirrors.aliyun.com/pypi/simple/
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
华中理工大学:http://pypi.hustunique.com/
山东理工大学:http://pypi.sdutlinux.org/
豆瓣:http://pypi.douban.com/simple/
永久:
解决方法不唯一,仅于此介绍最简单粗暴、小白易上手的方法--
将pip的下载源更换为国内的镜像源。
下载慢是因为pip默认下载源在国外。
换成国内各个优秀的镜像源就OK啦。
具体操作步骤:
1、敲开终端
2、敲命令
~$ mkdir ~/.pip
~$ vim ~/.pip/pip.conf
按ENTER进入新的空白文件,当然这是建立在ubuntu装了vim编辑器的前提下
3、编辑文件内容
[global]
index-url = http://mirrors.aliyun.com/pypi/simple
[install]
trusted-host=mirrors.aliyun.com
这是将国内阿里云的镜像源设置为pip的默认下载源的意思,而且是全局的,一次操作,终生无忧
4、保存,退出
5、之后在终端使用pip install 各种包就可以达到速度M/s级的啦
补充:
国内不只有阿里云的源,还有其他的,
博客介绍了将pip下载源更换为国内镜像源以解决下载慢的问题。列举了清华、阿里云等多个国内镜像源,还给出了将阿里云镜像源设为pip默认下载源的具体操作步骤,包括敲开终端、敲命令、编辑文件内容、保存退出等,操作后使用pip安装包速度可达M/s级。
1052

被折叠的 条评论
为什么被折叠?



