python 如何安装torch

打算折腾个gpt玩玩,需要一个叫torch的轮子,结果

报错了

好吧,技术不行,折腾了一大顿

装python3.7

发现torch只支持python3.9~3.7,于是用了个笨办法,又装了个py3.9

装好后在pycharm-文件-设置-项目:xxx-Python 解释器-添加解释器-添加本地解释器…,选Virtualenv 环境,环境那儿选现有,点右边仨点(shift+enter也行),一般都是C:\Users\abc\AppData\Local\Programs\Python\Python37\python.exe

装轮子

根据官网的提示,我们打开cmd,输入

C:\Users\abc\AppData\Local\Programs\Python\Python37\python.exe -m pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu117

(前边那串是你python37安装路径,不加默认安装以前的版本,还是报错)

然后就好了~

添加一个reaction吧!

讨论区

暂无评论

发表评论

系列文章
学习笔记/技术
License
许可协议:CC BY-SA 4.0
原文链接:https://loneapex.cn/archives/379