赞
踩
python选择anaconda的pytorch下的python
创建完项目后打开python console
导入import并检测是否可以调用GPU
在anaconda prompt中进入pytorch虚拟环境下载nb_conda,然后输入jupyter notebook进入网页jupyter,点击new找到自己创建的虚拟环境,点击进入后导入torch测试torch.cuda.is_available()是否为true
#创建名为pytorch的虚拟环境
conda create -n pytorch python=3.6
#进入该环境
conda activate pytorch
#安装nb_conda
conda install nb_conda
#进入jupyter notebook
jupyter notebook
安装过程中可能会出现一些小问题
方法一:安装命令换成:conda install nb_conda_kernels
方法二:pip install notebook
方法三:conda换源,打开C:\Users\XXX.condarc
修改下载路径:
ssl_verify: true
show_channel_urls: true
channels:
- http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/win-64/
- http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/win-64/
- defaults
在anaconda prompt中输入以下代码,向jupyter中添加对应的路径
python -m ipykernel install --user --name 环境名称 --display-name "Python (环境名称)"
可能是你在new中进入的虚拟环境不是你在anaconda中创建的pytorch环境,一、换new中别的虚拟环境试试,二、重新conda install nb_conda然后再重新进入jupyter notebook
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。