嗯 作为一个不久前刚学完机器学习的小白 目前正在入门深度学习
上个月已安装了anaconda,我是用了这篇链接的教程:
史上最全最详细的Anaconda安装教程
昨天配置了一下午的 Pytorch,但是不知道为什么一直出错,各种各样的错误……找了很多个网站和教程,晚上九点多的时候终于配置好了,今天花了一上午也把 jupyter notebook配置好了,下面介绍下我的方法:
前提:已经按照上面的教程配置好了anaconda
一、Pytorch
0.配置清华源:
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/conda-forge
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
# 设置搜索时显示通道地址
conda config --set show_channel_urls yes
1.配置虚拟环境
打开anaconda,输入:
conda create -n pytorch python=3.8
这里可以在cmd中输入python查看自己的python版本,我的是3.8
!!!注意!!!:
报错 UnavailableInvalidChannel: The channel is not accessible or is invalid 的解决办法:先把所以镜像源都删除 再重新载入清华源
conda config --remove-key channels
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/conda-forge
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
# 设置搜索时显示通道地址
conda config --set show_channel_urls yes
2.出现:
输入y
3.出现done 表示环境配置好了
接下来,输入:
conda activate pytorch
表示跳转到我们的虚拟环境pytorch中
4.去官网
pytorch官网
这里我用的是这个搭配:
找好自己的搭配,输入官网上"Run this Command"的链接就可以。
如何查看自己电脑的CUDA:
两种方法,一个是打开cmd,输入nvidia-smi 即可;
第二种方法请见这个链接:查询自己的CUDA
出现:
输入y
5.出现done表示安装成功
检验方法:输入import torch
,不报错证明pytorch包安装成功。
二、Jupyter notebook
我找了很多很多个教程,大部分都说的很乱……而且每个教程的方法都有不同,我试了一下,各有各的bug……最后终于发现了一个最好用的:修改Anaconda中Jupyter Notebook默认工作路径的详细图文教程(Win 10)
最后,大家有啥问题也可以在评论滴滴我,我真的试出来了太多bug了/(ㄒoㄒ)/……能帮的一定尽力帮哈,祝大家安装成功!