用conda虚拟环境解决py+torch环境问题

要事先安装wheel

pip install wheel
conda install nb_conda

安装nb_conda这样可以在shell切换虚拟环境启动jupyter notebook后切换到虚拟环境

 

创建虚拟环境

conda create -n python36 python=3.6
conda activate python36

加载后再pip安装torch1.4+cu101

所有版本torch 放在某个文件夹,比如桌面后

powershell切换到桌面安装

cd Desktop
pip install torch-1.4.0-cp36-cp36m-win_amd64.whl

 

进入jupyter,选择文件打开后,点kernel里切换服务,如果没有,那就powershell切换到虚拟环境

conda install ipykernel

再试一次

import torch
print (torch.__version__)
DLL load failed: 找不到指定的模块

你可能感兴趣的:(Note,anaconda,python)