目录
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,要么全都不
-
重置默认源:
conda config --remove-key channels
-
查看当前源配置
conda config --show channels
注意
镜像源是因为很多环境配置需要的包在国外,你想下的话,要么在终端里翻墙,要么就用镜像源。出于避免违规的原因,这篇博客单独讲镜像源。
首先有一些特殊的包只在某几个镜像源可用,如果你的镜像源不行,就换,以我个人的经验,清华的和阿里的能用
当你用pip时,修改pip的镜像源。用conda时修改conda的,这两个不互通
指定下载时通过哪个镜像源:
pip install 名字 -i 网址
conda install 名字 -i 网址
有不明白的可以参考这个人的博客
pip安装库包,及镜像源的配置_天兰之珠的博客-CSDN博客_pip镜像源配置
写一半有点懒 没人催我就先咕咕咕了