日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

win10 安装 Pytorch

發布時間:2025/3/21 编程问答 35 豆豆
生活随笔 收集整理的這篇文章主要介紹了 win10 安装 Pytorch 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

一、安裝Pytorch

打開官方網址
https://pytorch.org/get-started/locally/#supported-windows-distributions
選擇合適版本,復制最下方命令到CMD中安裝

出現如下錯誤

ReadTimeoutError: HTTPSConnectionPool(host='download.pytorch.org', port=443): Read timed out.


于是根據上面的鏈接,手動去下載,打開
https://download.pytorch.org/whl/torch_stable.html
搜索 cu92/torch-1.2.0%2Bcu92-cp36-cp36m-win_amd64.whl
然后用迅雷下載.
之后用下面命令安裝 (注意文件名不要有空格)

pip install torch-1.2.0+cu92-cp36-cp36m-win_amd64.whl

之后驗證是否安裝成功,結果出錯如下:

查詢解決辦法,現在Python版本是3.6.0,所以升級Python版本

conda update python

升級之后到了Python 3.6.2,再次驗證,問題解決!

>>> import torch >>> torch.__version__ '1.2.0+cu92'

Additionally, to check if your GPU driver and CUDA is enabled and accessible by PyTorch, run the following commands to return whether or not the CUDA driver is enabled:

>>> torch.cuda.is_available() True

二、安裝torchvision

首先用pip安裝失敗,安裝成功,但是導入時報錯from torch.C ......
torchvision ImportError: DLL load failed: 找不到指定的模塊。

pip install -i https://pypi.doubanio.com/simple/ torchvision

之后從官網下載安裝包手動安裝成功
torchvision-0.4.0+cu92-cp36-cp36m-win_amd64.whl
https://download.pytorch.org/whl/torch_stable.html

三、清華鏡像源安裝

最開始使用conda方式安裝,結果出現下面問題

解決方法: 首先添加清華的鏡像源,然后再安裝


原本的命令如上圖,添加清華源之后

conda install pytorch torchvision cudatoolkit=9.2

參考 https://blog.csdn.net/sunqiande88/article/details/80085569
(2020-2-3 未成功, Python現在是3.7之前3.6版本的torch沒法安裝了)

四、如何檢查顯卡支持哪個版本的CUDA ?

總結

以上是生活随笔為你收集整理的win10 安装 Pytorch的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。