conda

安装

下载地址

手动下载:官方地址:https://repo.anaconda.com/archive/index.html

服务器上直接下载:

复制代码
# 这里的Anaconda3-2021.05-Linux-x86_64.sh是在官网上选择好的conda的版本
wget -c https://repo.anaconda.com/archive/Anaconda3-2021.05-Linux-x86_64.sh

参考文章

linux conda环境安装-CSDN博客

安装

复制代码
# 一般正常yes,没什么意外情况

sh Anaconda3-2021.05-Linux-x86_64.sh

添加到环境变量

复制代码
# 编辑/etc/profile,并在末尾添加
export PATH=$PATH:${conda的安装位置}/bin
​
# 添加完保存再source /etc/profile,conda -V检查一下
​
############# 在脚本中 source ~/.bashrc #############

配置镜像

命令配置:

复制代码
# 命令示例
conda config --set show_channel_urls yes
conda config --add channels https://mirrors.aliyun.com/anaconda/pkgs/free

或者vim ~/.condarc

复制代码
# 提示这个无法访问时用下面的
channels:
  - http://mirrors.aliyun.com/anaconda/cloud/stackless
  - https://mirrors.aliyun.com/anaconda/cloud/simpleitk
  - https://mirrors.aliyun.com/anaconda/cloud/rdkit
  - https://mirrors.aliyun.com/anaconda/cloud/rapidsai
  - https://mirrors.aliyun.com/anaconda/cloud/qiime2
  - https://mirrors.aliyun.com/anaconda/cloud/pyviz
  - https://mirrors.aliyun.com/anaconda/cloud/pytorch3d
  - https://mirrors.aliyun.com/anaconda/cloud/pytorch-test
  - https://mirrors.aliyun.com/anaconda/cloud/pytorch
  - https://mirrors.aliyun.com/anaconda/cloud/psi4
  - https://mirrors.aliyun.com/anaconda/cloud/plotly
  - https://mirrors.aliyun.com/anaconda/cloud/omnia
  - https://mirrors.aliyun.com/anaconda/cloud/ohmeta
  - https://mirrors.aliyun.com/anaconda/cloud/numba
  - https://mirrors.aliyun.com/anaconda/cloud/msys2
  - https://mirrors.aliyun.com/anaconda/cloud/mordred-descriptor
  - https://mirrors.aliyun.com/anaconda/cloud/menpo
  - https://mirrors.aliyun.com/anaconda/cloud/matsci
  - https://mirrors.aliyun.com/anaconda/cloud/intel
  - https://mirrors.aliyun.com/anaconda/cloud/idaholab
  - https://mirrors.aliyun.com/anaconda/cloud/fermi
  - https://mirrors.aliyun.com/anaconda/cloud/fastai
  - https://mirrors.aliyun.com/anaconda/cloud/dglteam
  - https://mirrors.aliyun.com/anaconda/cloud/deepmodeling
  - https://mirrors.aliyun.com/anaconda/cloud/conda-forge
  - https://mirrors.aliyun.com/anaconda/cloud/caffe2
  - https://mirrors.aliyun.com/anaconda/cloud/c4aarch64
  - https://mirrors.aliyun.com/anaconda/cloud/bioconda
  - https://mirrors.aliyun.com/anaconda/cloud/biobakery
  - https://mirrors.aliyun.com/anaconda/cloud/auto
  - https://mirrors.aliyun.com/anaconda/cloud/Paddle
  - https://mirrors.aliyun.com/anaconda/pkgs/r
  - https://mirrors.aliyun.com/anaconda/pkgs/msys2
  - https://mirrors.aliyun.com/anaconda/pkgs/main
  - https://mirrors.aliyun.com/anaconda/pkgs/free
  
default_channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:
  conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud 
​
# 设置搜索时显示通道
show_channel_urls: true
​
ssl_verify: true
allow_conda_downgrades: true

常用命令

复制代码
# 创建虚拟环境
conda create -n ${虚拟环境名称} ${python==3.7}
conda create -p ${安装路径}
​
# 激活环境
conda activate ${虚拟环境名称}
​
# 退出环境
conda deactivate
​
# 查看虚拟环境
conda info --envs
​
# 删除虚拟环境
conda remove -n name --all
​
# 删除所有的安装包及cache(索引缓存、锁定文件、未使用过的包和tar包)
conda clean -y --all
​
# 列出已创建的虚拟环境
conda env list
​
# 取消base的默认激活
conda config --set auto_activate_base false
相关推荐
水母哟 ( ̄^ ̄)ゞ2 天前
Anaconda安装报错记录“usage: conda-script.py [-h] [--no-plugins] [-v] command
conda
Johny_Zhao3 天前
Conda、Anaconda、Miniconda对比分析
linux·网络安全·信息安全·kubernetes·云计算·conda·shell·containerd·anaconda·yum源·系统运维·miniconda
zhanghongyi_cpp4 天前
linux的conda配置与应用阶段的简单指令备注
linux·python·conda
躺不平的小刘7 天前
从YOLOv5到RKNN:零冲突转换YOLOv5模型至RK3588 NPU全指南
linux·python·嵌入式硬件·yolo·conda·pyqt·pip
yuanpan9 天前
ubuntu系统上的conda虚拟环境导出方便下次安装
linux·ubuntu·conda
runfarther9 天前
uv与conda的区别及选择指南
语言模型·conda·ai编程·uv
抠头专注python环境配置10 天前
OCR库pytesseract安装保姆级教程
python·ocr·conda
抠头专注python环境配置10 天前
Pytorch GPU版本安装保姆级教程
pytorch·python·深度学习·conda
wjf6300011 天前
Conda创建py3.10环境(股票),并且安装程序包的命令
conda
trayvontang12 天前
Python虚拟环境与包管理工具(uv、Conda)
python·conda·uv·虚拟环境·miniconda·miniforge