Miniconda安装使用教程

下载

官网地址:https://docs.conda.io/en/latest/miniconda.html
支持的系统: Windows 10 or newer, 64-bit macOS 10.13+, or Linux, including Ubuntu, RedHat, CentOS 7+, and others.
支持的系统架构: Windows- 64-bit x86, 32-bit x86; macOS- 64-bit x86 & Apple M1 (ARM64); Linux- 64-bit x86, 64-bit aarch64 (AWS Graviton2), 64-bit IBM Power8/Power9, s390x (Linux on IBM Z & LinuxONE).

根据自己的系统以及架构按需下载:

在这里插入图片描述

安装

Ubuntu 22.04.2 LTS (GNU/Linux 5.15.0-73-generic aarch64) 为例 (其他系统大同小异)

  1. 下载后将安装脚本上传至服务器
    在这里插入图片描述
  2. 设置Miniconda3-py38_23.3.1-0-Linux-aarch64.sh 的权限
sudo chmod 777 Miniconda3-py38_23.3.1-0-Linux-aarch64.sh

在这里插入图片描述
3. 运行安装脚本

./Miniconda3-py38_23.3.1-0-Linux-aarch64.sh
  • 回车继续
    在这里插入图片描述
  • 阅读协议(一直按回车知道出现让选择是否接受协议)
    在这里插入图片描述
  • 输入yes接受协议,不然不让安装
    在这里插入图片描述
  • 这一步是询问你是否要指定一个目录,我选择默认放在ubuntu用户目录下,直接回车即可,如果需要指定目录请输入目录路径再回车。
    在这里插入图片描述
  • 这一步是询问是否初始化Miniconda3,输入yes 回车即可。
    在这里插入图片描述
  • 这样就成功了,重新连接或者重新打开ssh工具即可。
    在这里插入图片描述
    在这里插入图片描述

使用

以下是一些常用命令,可按需使用。
····································································································································

查看conda版本

conda --version

在这里插入图片描述

更新conda版本

conda update conda

创建虚拟环境(-n是-name的缩写,conda_name为要创建的虚拟环境名,x.x 为创建的python版本号)

conda create -n conda_name python=x.x

输入 y

在这里插入图片描述

创建成功:

在这里插入图片描述

查看虚拟环境列表

conda env list

在这里插入图片描述

切换到创建的虚拟环境(也叫激活)

conda activate ispaq

在这里插入图片描述

查看当前环境依赖包列表

conda list

在这里插入图片描述

退出虚拟环境

conda deactivate

在这里插入图片描述

删除虚拟环境

# 先退出环境
conda deactivate

在这里插入图片描述

# 删除
conda remove -n conda_name --all

输入 y 继续:

在这里插入图片描述

删除成功:

在这里插入图片描述

关闭自动开启base环境

conda config --set auto_activate_base false

切换清华源

sudo ~/.condarc

在后面加入以下配置:

channels:
  - defaults
show_channel_urls: true
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
  pytorch-lts: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud

确认是否配置正确:

conda config --show-sources 

显示以下信息则正常:

在这里插入图片描述

卸载Miniconda

# 找到安装地址
find -name miniconda3
# 删除
sudo rm -rf Miniconda3

删除conda相关配置

sudo vim ~/.bashrc

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_52799373/article/details/131395508