miniconda官网地址:https://docs.conda.io/en/latest/miniconda.html
可以从清华大学镜像下载。地址 https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/
以官网为例,下载linux 64-bit python3.8版本、aarch64为arm架构。
1、ubuntu下安装
下载文件为:Miniconda3-latest-Linux-x86_64.sh
安装:
./Miniconda3-latest-Linux-x86_64.sh
一路回车,看说明。
step1、接受许可,必须选yes
Do you accept the license terms? [yes|no]
[no] >>> yes
step2、设置安装位置,默认为~/miniconda3
Miniconda3 will now be installed into this location:
~/miniconda3
- Press ENTER to confirm the location
- Press CTRL-C to abort the installation
- Or specify a different location below
step3、是否conda初始化python环境,选yes
[/home/svr/miniconda3] >>>
Do you wish the installer to initialize Miniconda3
by running conda init? [yes|no]
[no] >>> yes
这样就使用conda接管了默认的python环境。安装完成后,打印如下信息:
PS:可通过执行下面语句设置是够使用conda环境接管默认python,设置完后打开新终端生效。
conda config --set auto_activate_base false # 使用系统python
conda config --set auto_activate_base true # 默认使用conda
2、使用conda安装pytorch
conda create -n pro python=3.7.10 # 创建虚拟环境pro,指定python版本为3.7.10
conda activate pro # 激活虚拟环境pro
conda install pytorch==1.7.1 torchvision==0.8.2 cudatoolkit=10.2 # 安装pytorch
终端执行python,然后import torch验证结果。
3、conda最佳使用方式
step1、安装时,选择使用conda初始化python环境;
step2、安装完成后,设置使用系统环境:
conda config --set auto_activate_base false # 使用系统python
当使用虚拟环境时,使用conda activate env激活对应环境。
conda包管理相关: