win10使用清華源快速安裝pytorch-GPU版(推薦)
檢查自己的cuda是否安裝好
在anaconda prompt中輸入
nvcc -V
顯示如上面表示安裝好了。
配置清華園下載環(huán)境
同樣在在anaconda prompt中輸入
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 --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/peterjc123/conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/conda config --set show_channel_urls yes
然后刪除:C:\Users\Administrator 目錄下的 .condarc 文件,打開(kāi)文件刪除defaults那一行。如下圖所示:
點(diǎn)擊進(jìn)入pytorch官網(wǎng)
官網(wǎng)鏈接: https://pytorch.org/get-started/locally/.
自己選擇自己的版本,如下:
conda install pytorch torchvision cudatoolkit=10.1 -c pytorch
這行代碼的含義是:安裝pytorch時(shí)會(huì)把torchvision也給安裝上,就不用后面再安裝torchvision了。cudatoolkit=10.1表示cuda版本10.1。-c表示使用官網(wǎng)下載。不含-cpu表示gpu版。
配置自己cuda版本的pytorch,cuda版本過(guò)低怎么辦
如上所說(shuō),直接將cudatoolkit=10.1改為你自己的cuda版本,如我的是cuda 9.0:
conda install pytorch torchvision cudatoolkit=9.0 pytorch
安裝就行了。
安裝指定版本的torchvision
如果你在看代碼的時(shí)候,有些時(shí)候作者要求指定版本的torch或者torchvision,這個(gè)只能在官網(wǎng)上下載以前版本的文件。
點(diǎn)擊 Previous PyTorch Versions
上面就有你想要找到的版本對(duì)應(yīng)文件,下載下來(lái) pip install
就好了。需要注意很多版本問(wèn)題,如:cuda9.0的torchvison只支持到0.3.0版本等等。
驗(yàn)證你的pytorch安裝好沒(méi)有
這樣就安裝好了。
pythonimport torchexit()
恭喜你安裝成功。
總結(jié)
以上所述是小編給大家介紹的win10使用清華源快速安裝pytorch-GPU版,希望對(duì)大家有所幫助,如果大家有任何疑問(wèn)請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)網(wǎng)站的支持!
如果你覺(jué)得本文對(duì)你有幫助,歡迎轉(zhuǎn)載,煩請(qǐng)注明出處,謝謝!
相關(guān)文章:
1. win10下虛擬機(jī)中安裝Mac系統(tǒng)的圖文教程2. win10自帶的虛擬機(jī)設(shè)置網(wǎng)絡(luò)詳細(xì)步驟(圖文教程)3. WIN10家庭版搭建FTP文件服務(wù)器詳細(xì)教程4. Win10搭建FTP服務(wù)器實(shí)現(xiàn)局域網(wǎng)內(nèi)訪問(wèn)5. win10搭建配置ftp服務(wù)器的方法6. win10系統(tǒng)安裝Nginx的詳細(xì)步驟7. Win10下ftp搭建配置圖文教程(測(cè)試成功)8. WIN10安裝有多種數(shù)據(jù)庫(kù)時(shí)如何防止電腦卡慢問(wèn)題9. Win10系統(tǒng)搭建ftp文件服務(wù)器詳細(xì)教程10. WIN10使用IIS部署ftp服務(wù)器詳細(xì)教程
