输入以下命令:
conda install torchvision -c pytorch
pip install torchvision
指定匹配cuda版本安装命令:
conda install pytorch torchvision cudatoolkit=10.0 -c pytorch
指定pytorch和cuda版本安装:
conda install pytorch=1.0 torchvision cuda100 -c pytorch
二、修改源方法
在使用pip的时候在后面加上-i参数,指定pip源。例如:
pip install scrapy --user -i https://pypi.tuna.tsinghua.edu.cn/simple
卸载命令:
pip uninstall torch
查看pytorch的版本
编写如下的代码,运行代码即可了解当前的版本
>>> import torch
>>> torch.__version__
验证过程
安装pytorch(默认安装最新)
conda create -n py36 python=3.6
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --set showchannelurls yes
conda install pytorch torchvision cudatoolkit -c pytorch
conda install pytorch=1.0 torchvision cuda100 -c pytorch