如何在智星云主机配置 conda 和 pip 源

一、配置conda源

1、 conda源更换为北京外国语大学

Anaconda 是一个用于科学计算的 Python 发行版,支持 Linux, Mac, Windows, 包含了众多流行的科学计算、数据分析的 Python 包。TUNA 还提供了 Anaconda 仓库与第三方源(conda-forge、msys2、pytorch等,查看完整列表)的镜像,各系统都可以通过修改用户目录下的
.condarc 文件:

windows系统

Windows 用户无法直接创建名为
.condarc 的文件,可先执行

conda config --set
show_channel_urls yes 生成该文件之后再修改。

登录智星云windows云主机系统,打开conda控制台,在控制台执行

conda config --set
show_channel_urls yes
在这里插入图片描述
然后执行dir命令,可以看到文件
名.condarc 文件
在这里插入图片描述
在C:\Users\vipuser目录下编辑更改为以下源,用记事本打开,修改保存。
channels:

  • defaultsshow_channel_urls: truedefault_channels: - https://mirrors.bfsu.edu.cn/anaconda/pkgs/main - https://mirrors.bfsu.edu.cn/anaconda/pkgs/r - https://mirrors.bfsu.edu.cn/anaconda/pkgs/msys2custom_channels: conda-forge: https://mirrors.bfsu.edu.cn/anaconda/cloud msys2: https://mirrors.bfsu.edu.cn/anaconda/cloud bioconda: https://mirrors.bfsu.edu.cn/anaconda/cloud menpo: https://mirrors.bfsu.edu.cn/anaconda/cloud pytorch: https://mirrors.bfsu.edu.cn/anaconda/cloud pytorch-lts: https://mirrors.bfsu.edu.cn/anaconda/cloud simpleitk: https://mirrors.bfsu.edu.cn/anaconda/cloud
    在这里插入图片描述
    然后使用conda install xxxx安装需要的依赖包。

Linux系统通过编辑/home/vipuser目录下~/.condarc文件
channels:

  • defaults
  • show_channel_urls: true
  • default_channels: - https://mirrors.bfsu.edu.cn/anaconda/pkgs/main
  • https://mirrors.bfsu.edu.cn/anaconda/pkgs/r
    https://mirrors.bfsu.edu.cn/anaconda/pkgs/msys2custom_channels: conda-forge: https://mirrors.bfsu.edu.cn/anaconda/cloud msys2: https://mirrors.bfsu.edu.cn/anaconda/cloud bioconda: https://mirrors.bfsu.edu.cn/anaconda/cloud menpo: https://mirrors.bfsu.edu.cn/anaconda/cloud pytorch: https://mirrors.bfsu.edu.cn/anaconda/cloud pytorch-lts: https://mirrors.bfsu.edu.cn/anaconda/cloud simpleitk: https://mirrors.bfsu.edu.cn/anaconda/cloud

通过ssh连接的可以使用vim编辑器打开编辑
vim ~/.condarc修改完保存退出
在这里插入图片描述
2、注意如果需 要pytorch, 还需要添加pytorch的镜像:
conda config --add channels https://mirrors.bfsu.edu.cn/anaconda/cloud/pytorch/

3、如果需要换回conda的默认源,直接删除channels即可,命令如下:
conda config --remove-key channels

补充:不要使用清华源,清华源教育网好使,非教育网不好使

上海交通大学开源镜像站
channels: - https://mirrors.sjtug.sjtu.edu.cn/anaconda/pkgs/main/ - https://mirrors.sjtug.sjtu.edu.cn/anaconda/pkgs/free/ - https://mirrors.sjtug.sjtu.edu.cn/anaconda/cloud/conda-forge/ssl_verify: true

二、配置pip源

1、临时使用
pip install -i https://mirrors.bfsu.edu.cn/pypi/web/simple some-package注意,simple 不能少, 是 https 而不是 http

windows下在命令行执行
在这里插入图片描述
Linux下如果conda 环境没有pip命令可以用conda install pip安装
在这里插入图片描述
2、设为默认
升级 pip 到最新的版本(>=10.0.0) 后进行配置:
pip install pip -U pip config set global.index-url https://mirrors.bfsu.edu.cn/pypi/web/simple

补充:

阿里云镜像源

永久换源
pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/

临时换源安装matplotlib
pip install -i https://mirrors.aliyun.com/pypi/simple/ matplotlib

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值