Anaconda在虚拟环境安装pytorch
这里默认你已经安装了anaconda
准备
查python版本命令:python -V
Python 3.7.1
查看cuda版本命令nvcc -V
Cuda compilation tools, release 9.0, V9.0.176
CUDA 10.0
Download and install wheel from https://download.pytorch.org/whl/cu100/torch_stable.html
CUDA 9.0
Download and install wheel from https://download.pytorch.org/whl/cu90/torch_stable.html
CPU only
Download and install wheel from https://download.pytorch.org/whl/cpu/torch_stable.html
进入官网使用迅雷下载CUDA 9.0版本的:torch-1.1.0-cp37-cp37m-win_amd64.whl和torchvision-0.3.0-cp37-cp37m-win_amd64.whl
安装pytorch
------anaconda 虚拟环境----
创建虚拟环境pytorch:
conda create --name pytorch python=3.6
进入虚拟环境:
conda activate pytorch
推荐使用pip安装方式(pip3;cd到文件目录):
pip3 install torch-1.1.0-cp37-cp37m-win_amd64.whl
pip3 install torchvision-0.3.0-cp37-cp37m-win_amd64.whl
验证:命令行输入python进入python
import torch
import torchvision
print(torch.version)
推出虚拟环境:
conda deactivate
jupyter使用创建的虚拟环境:
打开Prompt
(pytorch环境下)
pip install ipykernel
(base环境下)
conda install -n name ipykernel