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 文件,打開文件刪除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版本過低怎么辦
如上所說,直接將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)文件,下載下來 pip install
就好了。需要注意很多版本問題,如:cuda9.0的torchvison只支持到0.3.0版本等等。
驗(yàn)證你的pytorch安裝好沒有
這樣就安裝好了。
pythonimport torchexit()
恭喜你安裝成功。
總結(jié)
以上所述是小編給大家介紹的win10使用清華源快速安裝pytorch-GPU版,希望對(duì)大家有所幫助,如果大家有任何疑問請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)網(wǎng)站的支持!
如果你覺得本文對(duì)你有幫助,歡迎轉(zhuǎn)載,煩請(qǐng)注明出處,謝謝!
相關(guān)文章:
1. win10自帶的虛擬機(jī)設(shè)置網(wǎng)絡(luò)詳細(xì)步驟(圖文教程)2. Win10系統(tǒng)搭建ftp文件服務(wù)器詳細(xì)教程3. win10下FTP服務(wù)器搭建圖文教程4. WIN10安裝有多種數(shù)據(jù)庫時(shí)如何防止電腦卡慢問題5. WIN10下的JDK安裝與配置環(huán)境變量的過程(詳細(xì)版)6. Win10下配置IIS10并支持調(diào)試ASP程序的步驟7. VSCode連接實(shí)驗(yàn)室服務(wù)器Xshell,Xftp向服務(wù)器傳輸文件的方法(win10)8. Win10下jdk安裝及環(huán)境變量配置詳細(xì)教程9. win10系統(tǒng)安裝Nginx的詳細(xì)步驟10. Win10下ftp搭建配置圖文教程(測試成功)
