pytorch入门

安装anaconda

官网下载安装,安装时加上path

准备环境

创建环境

1
2
# 创建环境
conda create -n [namespace] python=[3.7] -y

安装pytorch

复制以下命令到anaconda prompt

1
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu117

1694159416448

安装jupyter

1
2
3
4
5
pip install jupyter
pip install jupyter_contrib_nbextensions
jupyter contrib nbextension install --user
pip install --user jupyter_nbextensions_configurator
jupyter nbextensions_configurator enable --user

启动

1
2
3
4
5
jupyter notebook
# 没有出能写代码的地方怎么办
conda install -c conda-forge nb_conda
#
conda install nb_conda # 确实牛逼