conda常用命令
1.创建、启动虚拟环境
conda create -n env_name python=3.7
conda activate env_name
如果出现如下类似错误:
nvalidArchiveError(‘Error with archive /usr/local/Anaconda3/pkgs/sqlite-3.36.0-hc218d9a_0stdo5ow0/info-sqlite-3.36.0-hc218d9a_0.tar.zst. You probably need to delete and re-download or re-create this file. Message from libarchive was:\n\nCould not unlink’)
————————————————
解决办法:
找到对应的pkgs包,赋权限777即可
sudo chmod -R 777 /usr/local/Anaconda3/pkgs/
2.查看虚拟环境用户
conda env list
3.查看安装软件版本
conda list
conda 安装torch等
参考:https://pytorch.org/get-started/previous-versions/
# 先创建虚拟账户然后
conda install pytorch==1.12.1 torchvision==0.13.1 torchaudio==0.12.1 cudatoolkit=10.2 -c pytorch
默认国外源,安装太慢,修改源:
将以上配置文件写在~/.condarc中
vim ~/.condarc
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
ssl_verify: true