使用anacond prompt安裝pytorch
GPU版本的教程請點選此處檢視
·首先去anaconda官網安裝anaconda,然後打開anaconda prompt(pycharm配置環境略過):
在指令行輸入:
來建立一個關于pytorch的單獨環境
這裡的‘pytorch’是環境名稱,python=3.8是版本,都可以根據需求自行修改
然後就可以進入我們建立好的虛拟環境:
activate pytorch
然後我們可以切換一下源:切換源能夠更快的下載下傳 包
配置清華源,在指令行輸入:
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/pytorch/
conda config --set show_channel_urls yes
然後一切準備工作做好之後,接下來開始安裝pytorch,在指令行輸入:
conda install pytorch torchvision torchaudio cpuonly -c pytorch
輸入之後等待一會再輸入‘y’(确認下載下傳)
最後在指令行輸入:
然後會列出這個環境所有的包,可以檢視有沒有‘torch’
![](https://img.laitimes.com/img/9ZDMuAjOiMmIsIjOiQnIsIyZuBnLkBTMzQmN4YDOkZjNxMGOiFmYxQTM0U2N1IWYiFzNjR2Lc52YucWbp5GZzNmLn9Gbi1yZtl2Lc9CX6MHc0RHaiojIsJye.png)
出現torch就代表成功了!
歡迎關注作者,有什麼問題可以一起讨論!