pytorch安装配置(VScode +miniconda+pytorch)
生活随笔
收集整理的這篇文章主要介紹了
pytorch安装配置(VScode +miniconda+pytorch)
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
準(zhǔn)備工作:
1.安裝VScode
2.安裝miniconda
3.安裝CUDA9.0
4.安裝cuDNN7.0
參考文章:python安裝配置(miniconda版)(Win10+VScode +miniconda),CUDA9.0+cuDNN7.0安裝配置
-------------------------------------以下是正文----------------------------
一、安裝pytorch
1.打開miniconda,創(chuàng)建環(huán)境
//pytorch為環(huán)境名,3.6為python版本號 conda create -n pytorch python=3.6
2.安裝pytorch
添加鏡像源,注意一行一行輸入
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ conda config --set show_channel_urls yes conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/ //這一個是新增加的
?
然后安裝
conda activate pytorch //激活環(huán)境 conda install pytorch==1.1.0 torchvision==0.3.0 cudatoolkit=9.0 //安裝cuda9.0對應(yīng)的pytorch版本
3.新增環(huán)境變量
?
檢查是否安裝成功,pipshow torch
?
4.新建python文件,輸入代碼,并運行
import torch print(torch.__version__) print(torch.cuda.is_available())
安裝成功。
?
【備注】如果運行過程報錯,大概就是找不到numpy,DLL load failed: 找不到指定的模塊。
解決方法:用pip重新安裝numpy(若numpy下載過程出現(xiàn)錯誤,是網(wǎng)速問題)
pip uninstall numpy //卸載numpy pip3 install numpy==1.14.0 //用pip重新安裝numpy
總結(jié)
以上是生活随笔為你收集整理的pytorch安装配置(VScode +miniconda+pytorch)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 变形坦克2阿玛达坦克怎么用变形坦克2阿玛
- 下一篇: 《三国征途》部队组建要点介绍