Anaconda环境配置
安装完之后需要进行环境配置,直接打开终端输入:
sudo gedit ~/.bashrc #进行bashrc环境文件
打开bashrc文件后,在尾部加入:
export PATH="/home/kiligubu/anaconda3/bin:$PATH"
注意地址换成自己的。
然后重启或者在终端输入:
source ~/.bashrc #刷新
重启终端。
添加镜像源
kiligubu@kiligubu-virtual-machine:~$ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
kiligubu@kiligubu-virtual-machine:~$ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
kiligubu@kiligubu-virtual-machine:~$ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
kiligubu@kiligubu-virtual-machine:~$ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
kiligubu@kiligubu-virtual-machine:~$ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
kiligubu@kiligubu-virtual-machine:~$ conda config --set show_channel_urls yes
创建虚拟环境并配置pytorch
创建虚拟环境:
kiligubu@kiligubu-virtual-machine:~/anaconda3$ conda create -n pytorch python=3.9
conda env list
kiligubu@kiligubu-virtual-machine:~/anaconda3$ source activate
(base) kiligubu@kiligubu-virtual-machine:~/anaconda3$ conda activate pytorch
(pytorch) kiligubu@kiligubu-virtual-machine:~/anaconda3$ conda activate base
(base) kiligubu@kiligubu-virtual-machine:~/anaconda3$ conda env list
# conda environments:
#
base * /home/kiligubu/anaconda3
pytorch /home/kiligubu/anaconda3/envs/pytorch
(pytorch) kiligubu@kiligubu-virtual-machine:~/anaconda3$ cd envs/pytorch
(pytorch) kiligubu@kiligubu-virtual-machine:~/anaconda3/envs/pytorch$ conda install pytorch==1.13.1 torchvision==0.14.1 torchaudio==0.13.1 pytorch-cuda=11.6