11.14 杂项 配置gpu torch 环境

在尝试安装torch-1.4.0+cpu-cp38-cp38m-win32.whl时遇到错误,通过修改安装包名称为torch-1.4.0+cpu-cp38-none-win32.whl并使用pip安装,问题得到解决。如果仍无法成功,可以运行`python -m pip debug --verbose`进行排查。最后,检查torch的CUDA可用性。
摘要由CSDN通过智能技术生成
import setuptools.pep425tags   #根据自己pep425tags文件位置进行相应更改
print(setuptools.pep425tags.get_supported())

报错:ERROR: torch-1.4.0+cpu-cp38-cp38m-win32.whl is not a supported wheel on this platform.
解决方法:
在自己的python文件夹的site-packages中寻找pep425tags.py文件

2、修改为 pip install torch-1.4.0+cpu-cp38-none-win32.whl,安装成功

3、上面的都不好使  用这行 代码 python -m pip debug --verbose

4、torch.cuda.is_available()

import os
import torch
from torch import nn
from torch.utils.data import DataLoader
from torchvision import datasets, transforms

device = "cuda" if torch.cuda.is_available() else "cpu"
print(f"Using {device} device")

class NeuralNetwork(nn.Module):
    def __init__(self):
        sup
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

python@king

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值