一、创建环境
打开anaconda prompt
conda create -n t_3_8 python=3.8
t_3_8是环境名称
python=3.8 是自己安装的python版本
遇到Y/N这种提示 就是问你确定吗的意思 输入Y回车即可。
最后可能会问你要不要装VSCODE 看你个人意愿,我是不装的。
二、进入环境
conda activate t_3_8
注意前缀变了,后面安装所有的包都应该在这个前缀下安装。
三、在pycharm中选择深度学习环境
点击pycharm右下角解释器
点添加环境, 点现有环境 。 然后点解释器右边三个点 , 选刚才安装conda目录中刚才创建环境下的python.exe文件。 点确定。
四、安装torch等环境
回到anaconda prompt 。就那个黑框框。 确保你在前面你创建的环境中。
1. 添加清华源
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud//pytorch/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
conda config --set show_channel_urls yes
2.选择torch版本
(10.2)
pip install torch==1.10.1+cu102 torchvision==0.11.2+cu102 torchaudio==0.10.1 -f https://download.pytorch.org/whl/cu102/torch_stable.html
或者直接用清华源
pip install torch==1.10.1+cu102 torchvision==0.11.2+cu102 torchaudio==0.10.1 -f https://pypi.tuna.tsinghua.edu.cn/simple
卡住不动就猛敲回车