使用requirements.txt文件安装cuda(GPU)版本的pytorch

使用requirements.txt文件安装cuda(GPU)版本的pytorch

问题描述

使用requirements.txt可以轻松地帮助我们配置新环境,然而,当使用requirements.txt安装pytorch时有时会出现仅能安装cpu版本pytorch的情况。

举例说明:

requirements.txt文件内容如下:

torch==2.0.1
torchaudio==2.0.2
torchvision==0.15.2

此时在anaconda promot中输入

pip install -r requirements.txt

然后会发现,安装的是cpu版本的pytorch

这里输出的也是False

解决方法

应该将requirements.txt文件改为如下形式

torch==2.0.1+cu117
torchaudio==2.0.2+cu117
torchvision==0.15.2+cu117
-f https://download.pytorch.org/whl/torch_stable.html

然后再在anaconda promot中输入

pip install -r requirements.txt

此时安装的就是cuda版本的pytorch

这里输出是True

相关推荐
innutritious17 分钟前
车辆重识别(2020NIPS去噪扩散概率模型)论文阅读2024/9/27
人工智能·深度学习·计算机视觉
PythonFun17 分钟前
Python批量下载PPT模块并实现自动解压
开发语言·python·powerpoint
醒了就刷牙1 小时前
56 门控循环单元(GRU)_by《李沐:动手学深度学习v2》pytorch版
pytorch·深度学习·gru
炼丹师小米1 小时前
Ubuntu24.04.1系统下VideoMamba环境配置
python·环境配置·videomamba
橙子小哥的代码世界1 小时前
【深度学习】05-RNN循环神经网络-02- RNN循环神经网络的发展历史与演化趋势/LSTM/GRU/Transformer
人工智能·pytorch·rnn·深度学习·神经网络·lstm·transformer
GFCGUO1 小时前
ubuntu18.04运行OpenPCDet出现的问题
linux·python·学习·ubuntu·conda·pip
985小水博一枚呀2 小时前
【深度学习基础模型】神经图灵机(Neural Turing Machines, NTM)详细理解并附实现代码。
人工智能·python·rnn·深度学习·lstm·ntm
SEU-WYL3 小时前
基于深度学习的任务序列中的快速适应
人工智能·深度学习
OCR_wintone4213 小时前
中安未来 OCR—— 开启高效驾驶证识别新时代
人工智能·汽车·ocr
matlabgoodboy4 小时前
“图像识别技术:重塑生活与工作的未来”
大数据·人工智能·生活