打开"C:\Users{用户名}.condarc" 文件(如果没有,可以先执行第三步的第一条命令)
channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
- 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
simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
完整文件:
ssl_verify: true
channels:
- https://mirrors.ustc.edu.cn/anaconda/cloud/conda-forge/
- https://mirrors.ustc.edu.cn/anaconda/pkgs/free/
- https://mirrors.ustc.edu.cn/anaconda/pkgs/main/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/win-64/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
- 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
simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
Anoconda PoweShell Prompt是miniconda的命令行页面,使用cmd, PowerShell等命令行有些命令无法执行,需要conda init ,但是我没有执行成功。【win】,搜索Anoconda就可以找到了。
显示安装的源:
conda config --set show_channel_urls yes
显示信息:
conda info
显示有哪些环境:
conda env list
conda info -e
创建环境:
conda create --name py35 python=3.5
删除已有的环境:
conda remove --name py35 --all
错误(下载中途中断):
conda remove --name py35 --all
conda env remove -n pytorch_test
激活环境:
conda activate py35
退出环境:
conda deactivate py35
安装pytorch
pytorch 官网
conda install pytorch torchvision torchaudio cudatoolkit=10.2 -c pytorch
pip修改默认安装路径:
python -m site -help
# 获得site.py的路径,修改文件中的两个变量的初值。
USER_SITE = r'D:\software\miniconda\Lib\site-packages'
USER_BASE = r'D:\software\miniconda\Scripts'
conda 安装本地包
conda install --use-local pytorch-1.10.1-py3.9_cuda10.2_cudnn7_0.tar.bz2