镜像源问题

目录

常用镜像源地址

修改镜像源的方法

直接修改pip镜像源文件

linux

win

直接修改conda镜像源文件

命令行修改

注意


this problem is hard to fix, so i suggest u try to connect foreigner internet directly. (as u can see, only chinese need to use 镜像源 which is not friendly for chineses AI learner)

有的包只能在特定的镜像源下才能下载成功

比如清华源,联通的宽带一般用不了

可以用usb连接手机,走手机的流量,具体操作见另一篇博客manjaro

也可以用export的命令在终端中链接梯子(linux),可以参考clash那篇博客。注意,建议就算已经挂梯子了,终端不输命令就是没有链接上

常用镜像源地址

注意,中间写tsinghua代表是清华源,其他同理

  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
  - https://mirrors.nju.edu.cn/anaconda/pkgs/free/

  - https://mirrors.aliyun.com/anaconda/pkgs/r
  - https://mirrors.aliyun.com/anaconda/pkgs/msys2
  - https://mirrors.aliyun.com/anaconda/pkgs/main/

下面这个是我在苏州的联通网络下用的

channels:
  - https://mirrors.ustc.edu.cn/anaconda/pkgs/main/
  - https://mirrors.ustc.edu.cn/anaconda/pkgs/free/
  - https://mirrors.bfsu.edu.cn/anaconda/cloud/pytorch/
  
  - https://mirrors.aliyun.com/anaconda/pkgs/r
  - https://mirrors.aliyun.com/anaconda/pkgs/msys2
  - https://mirrors.aliyun.com/anaconda/pkgs/main/
custom_channels:
  conda-forge: http://mirrors.aliyun.com/anaconda/cloud
  msys2: http://mirrors.aliyun.com/anaconda/cloud
  bioconda: http://mirrors.aliyun.com/anaconda/cloud
  menpo: http://mirrors.aliyun.com/anaconda/cloud
  pytorch: http://mirrors.aliyun.com/anaconda/cloud
  simpleitk: http://mirrors.aliyun.com/anaconda/cloud

修改镜像源的方法

有两种方法:直接修改文件,命令行修改。建议直接修改文件的方法

直接修改pip镜像源文件

修改源:

win

在 C:\Users\用户名 文件夹下新建pip文件夹及pip.ini文件,写入

[global]

index-url=http://mirrors.aliyun.com/pypi/simple/

trusted-host=mirrors.aliyun.com

linux

在用户文件夹下新建.pip文件夹及pip.conf文件,写入

[global]

index-url=http://mirrors.aliyun.com/pypi/simple/
extra-index-url=https://mirrors.ustc.edu.cn/pypi/web/simple

trusted-host=mirrors.aliyun.com
trusted-host=mirrors.ustc.edu.cn

manjaro

manjaro linux系统镜像源_manjaro镜像下载-CSDN博客

直接修改conda镜像源文件

win

C:\Users\用户名\.condarc

linux

找到.bashrc这个文件,一般是在home/用户名 这个文件夹下面,添加路径采用这个语句:

export PATH="$PATH:/home/mage/miniconda3/bin"

然后source ./.bashrc 

命令行修改

请注意基于linux的系统,比如manjaro,普通用户和root用户可以视作两个电脑,sudo设置的配置文件,和普通用户不同,因此进行镜像源的设置和安装时,要么全都sudo,要么全都不

  1. 重置默认源

    conda config --remove-key channels

  2. 查看当前源配置

    conda config --show channels

注意

镜像源是因为很多环境配置需要的包在国外,你想下的话,要么在终端里翻墙,要么就用镜像源。出于避免违规的原因,这篇博客单独讲镜像源。

首先有一些特殊的包只在某几个镜像源可用,如果你的镜像源不行,就换,以我个人的经验,清华的和阿里的能用

当你用pip时,修改pip的镜像源。用conda时修改conda的,这两个不互通

指定下载时通过哪个镜像源:

pip install 名字 -i 网址

conda install 名字 -i 网址

有不明白的可以参考这个人的博客

pip安装库包,及镜像源的配置_天兰之珠的博客-CSDN博客_pip镜像源配置

写一半有点懒 没人催我就先咕咕咕了

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

坠金

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值