Pytorch环境安装问题解决

Python安装torch(含torch和torchvision对应版本) python安装torch和torchvision,解决安装出错问题。 阅读详情

我的安装环境是 win10 + cuda 10.0 + anconda

之前去官网安装,发现太慢了,而且对应版本不对,官网下载的对应cuda选择只有 9.2,10.1,10.2

这里还有个坑是 查看自己电脑的cuda对应版本,我忘记之前下载的cuda版本了,所以想再查看一下

方法1:进入NVIDIA控制面板,选择进入导航栏的帮助中的系统信息,点击组件查看。

这种方式显示我的cuda版本是10.1,这个应该是系统自带的版本

方法2:cmd在命令行输入 nvcc --version 

这种方式显示我的cuda版本是10.0

 

然后去官网 https://pytorch.org/get-started/locally/

得到版本网站 https://download.pytorch.org/whl/torch_stable.html

选择自己适合的版本,下载之后 pip安装

最开始,我选择的是 torch1.2.0 和 torchvision 0.4.0

但是安装完之后发现,会出现 “AttributeError: 'torch._C.Value' object has no attribute xxx” 的问题

查了很久,发现可能是 torch 1.2.0的问题

然后重新下载 安装了 torch 1.1.0 和 torchvision 0.3.0

这下 可以 import torch了

但是 import torchvision 的时候出了问题

经过下面链接处理,终于可以成功导入了

链接: https://blog.youkuaiyun.com/Lee_lg/article/details/103901632

PyTorch版本匹配完全指南:告别安装报错的血泪经验(2025最新版) ⚠️致命陷阱1:不要用!这是第三方包,正牌是torch⚠️隐藏大坑2conda update --all # 这句能解决90%的依赖冲突⚠️玄学问题3print(torch.__version__) # 应该显示2.1.0print(torch.cuda.is_available()) # 必须返回True!记得去年帮学弟配环境时,因为没注意torchvision版本,结果在实验室调试到凌晨三点(别问,问就是泪)。希望这篇指南能让大家少走弯路,如果还有坑没写到——欢迎在评论区开炮! 阅读详情

相关推荐

Win10+Anaconda环境下安装Pytorch以及解决其下载缓慢问题

1.Pytorch安装步骤 (1)打开Anaconda Prompt (2)建立Pytorch Anaconda虚拟环境 conda create --name pytorch python=3.7 anaconda 建立虚拟环境好处:因为环境中通常需要安装很多软件,但是他们所需要的Python的关联模块或版本会有所差异。如果都装在一个环境中难免会引起冲突。所以,选择虚拟环境能很好地避免环境之间的冲突。 (3)启动Pytorch Anaconda虚拟环境 activate pytorch (4)安

Kudou_Shin1chi的博客 1164

cuda12.1+torch2.1.0安装

最新版本cuda、pytorch安装

cg267007287的博客 3072

pytorch的安装方法及出现问题的解决方案(Mac中使用conda安装pytorch深度学习的虚拟环境)

pytorch的安装方法及出现问题的解决方案: 安装pytorch,使用pip 安装,在运行代码的时候会报错,但是导包的时候不会报错,因此要采用conda的方式安装 1、找到miniconda的网址安装miniconda,https://docs.conda.io/en/latest/miniconda.html,选择版本64-bit (bash installer),目前我选择的版本是这个版本,...

weixin_42540746的博客 2039

pytorch2.1.0+cuda 12.1 环境配置自用学习笔记

pytorch2.1.0+cuda12.1 python3.10.11环境配置自用学习笔记

qq_53434590的博客 1641

Linux-Anaconda虚拟环境 安装配置GPU版本Pytorch 流程+遇到与解决问题小结

遇到问题 最近在用pytorch跑深度学习模型,不过一直用的是CPU,训练速度还是跟不上,正好实验室服务器比较空闲,而且cuda、cudnn也都是配置好了的,所以打算在上面的anaconda虚拟环境中配置一下我想要用的gpu版本的pytorch,配置期间遇到了不少问题,也参考了很多博主的经验,现自己总结记录一下。 总结 先说结论,代码可以跑起来了就会发现,事情怎么这么简单(笑哭),但其实是将近一周的折腾才搞好的。因为我只想连服务器的gpu用一下,上面cuda、cudnn都已经配置好了的,我只需要装一个gpu

weixin_42416791的博客 3784

PyTorch安装问题:环境解决失败

以上是一些常见的解决方案,用于解决PyTorch安装过程中的环境解决失败问题。根据你的具体情况,可能需要尝试其中的一种或多种方法。希望这些解决方案能够帮助你成功安装PyTorch并进行深度学习的开发工作。在进行PyTorch安装的过程中,有时候会遇到"环境解决失败"的问题。如果以上方法仍然无法解决你的问题,建议你在PyTorch的官方论坛或社区寻求帮助,这里有更多有经验的开发者可以为你提供支持和指导。如果你的Python版本过低,你可以考虑升级到较新的版本。根据输出信息,确保所有的依赖项都已正确安装。

AvGroovy的博客 1689

Anaconda安装虚拟cuda环境——解决Pytorch无法识别cuda的问题

在 Anaconda 的环境配置过程中,明明根据电脑已经安装的 cuda 版本从 Pytorch 官网上安装了对应版本的 torch 包 但依然无法调用 GPU 进行 torch 任务,编辑 GPUtest.py 文件。得到结果如下:torch 无法正常识别到 cuda。打开 Anaconda Prompt 输入,nvidia-smi 查看当前 GPU 驱动程序nvidia-smi得到驱动版本是551.61,CUDA 版本是12.4。

qq_40163992的博客 4465

torch1.2.0+torchvision0.4.0.rar

在pytorch上下载资源过慢,所以存了下来方便大家使用,这里的torch是1.2.0版本,torchvision是0.4.0版本,先安装torch(pip install 下载目录),再安装torchvision(pip install 下载目录)

解决Anaconda安装pytorch环境出现InvalidArchiveError问题

在安装 pytorch环境得时候出现报错,管理员权限问题找到anaconda得文件夹 右键找到属性因为这个没有完全控制的属性,把他换成下面那个,就是下面这个但是我用完之后还是出现了报错一直安装不上。

梁小布的博客 2257

torch-2.1.0a0+41361538.nv23.06-cp38-cp38-linux-aarch64.whl

jetson官方提供torch安装包需要系统默认环境是python3.8,不要在jetson上使用anaconda安装这个

CAS5和CAS6自定义异常提示消息

CAS自定义异常提示消息

weixin_42949219的博客 980

Windows本地部署知识库-解决Conda环境下pytorch-cuda安装版本问题

下载完成后,双击安装程序进行安装,按照提示完成安装过程并重启电脑。可以通过打开控制面板->设备管理器->显示适配器查看是否有。安装显卡驱动之前,需要先确认电脑是否支持。,下滑到下图位置,按照自己电脑的。下载对应型号的显卡驱动;桌面鼠标右键->选择。NVIDIA控制面板。

Andy O`Connor的博客 678

matianl:SAP 最详细的权限管理解析

上文所说的系统自带权限对象与权限字段仅能满足有限的需要,其权限审核的逻辑也是系统硬编码了的,我们能做的只是是否启用某项权限对象的检查(使用SU22)。如果需要自定义,通过SU20、SU21定义即可。

matinal 當冬夜漸暖 。公众号:matinal 2155

【环境配置问题】关于Anaconda中Pytorch环境下安装Jupyter,启动时kernel死亡的问题解决

关于Anaconda中Pytorch环境下安装Jupyter,启动时kernel死亡的问题解决

weixin_45671524的博客 1887

戴尔PowerEdge服务器R450 RAID配置步骤

戴尔PowerEdge服务器R450 RAID配置步骤

且听风呤tmj的博客 6915

Autosar开发实战:DaVinci Configurator Pro新建工程保姆级教程(附目录结构解析)

本文详细介绍了使用DaVinci Configurator Pro创建Autosar工程的完整流程,包括环境准备、工程配置、目录结构解析及常见问题排查。通过实战演示和深度解读,帮助开发者快速掌握工具使用技巧,优化工程管理,提升开发效率。特别适合需要理解Autosar开发中DaVinci Config工具链的工程师。

weixin_30872157的博客 463

解决 Flash-Attention 安装问题:基于 PyTorch 2.7.0 的环境配置

flash-attn==2.7.4.post1适配torch 2.7.0

阿正的梦工坊 3888

RK3588上从零部署Facenet人脸识别:PyTorch转ONNX再到RKNN的完整避坑指南

本文提供了在RK3588开发板上从零部署Facenet人脸识别模型的完整指南。详细介绍了从PyTorch模型导出、转换为ONNX格式,再通过RKNN-Toolkit2转换为RKNN格式的完整流程,并重点分享了环境配置、算子兼容性处理、量化调优及板端部署中的关键步骤与避坑经验。

river的博客 465

解决安装完pytorch虚拟环境后的无法在jupyter中new该环境进行调用的问题

今天在学习pytorch的过程中,创建了虚拟环境pytorch但是在jupyter中使用时发现没法使用这个环境。 1.问题:jupyter中无法新建关于pytroch环境的文件 2解决: (1)在anaconda prompt中对pytorch环境安装nb_conda (2)安装完后重启jupyter后可以出现conda栏目并且pytorch为默认环境,问题解决。 ...

qq_41978509的博客 1979

Windows 下 Hermes Agent(爱马仕)安装全记录:从零到一的保姆级图文教程

本文主要介绍了Windows 下 Hermes Agent(爱马仕) 安装全记录:从零到一的保姆级图文教程,希望能对学习使用 Hermes Agent 的同学们有所帮助。 文章目录 1. 背景 2. 实战教程 2.1 步骤一 安装WSL环境 2.2 步骤二 安装Python环境 2.3 步骤三 安装Hermes Agent 2.4 步骤四 修正 API Key 错误 2.5 步骤五 配置多个模型 2.6 步骤六 启动Hermes Agent 3. 常见问题及解决方案 4. 总结

weixin_43178406的博客 14万+

基于截图详解:SAP GUI for Java 如何设置登录链接,以及 conn= 连接字符串该怎么写

摘要:SAP GUI for Java 的连接属性配置关键是在"高级"页签的"conn="后填写连接字符串。连接字符串格式取决于网络拓扑:直连应用服务器使用"/H/主机/S/端口";通过消息服务器负载均衡使用"/M/消息服务器/S/端口/G/组名";经SAProuter访问则需添加路由器前缀。配置时需注意专家模式会覆盖其他页签设置,且连接字符串还支持附加参数如客户端、语言和默认事务码。具体填写内容应根据Basis团队提供的系统信

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 252

PyTorch安装失败常见问题汇总及Miniconda环境下的解决方案

PyTorch安装常因依赖冲突、CUDA不匹配或网络问题失败。通过Miniconda创建隔离环境,结合Python 3.10与国内镜像源,可高效规避这些问题。利用Conda通道获取预编译包,导出environment.yml实现环境复现,真正实现“一次配置,处处运行”,提升AI开发的稳定性和协作效率。

weixin_30789053的博客 1015

Unreal Engine Profiler:动画系统性能分析教程_2024-07-23_03-05-38.Tex

Unreal Engine Profiler 是一个内置的性能分析工具,它可以帮助开发者识别和解决游戏中的性能瓶颈。Profiler 提供了详细的性能数据,包括 CPU 使用率、GPU 负载、内存使用情况等,特别针对动画系统,可以查看动画蓝图的执行时间、骨骼动画的计算成本、以及动画混合和重定向的效率。通过这些数据,开发者可以定位到具体的问题,比如哪些动画状态消耗了过多的 CPU 时间,或者哪些动画资源导致了内存泄漏。

827

【自用】anaconda环境下的pytorch安装遇见的问题和稀里糊涂的解决方案

提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档 文章目录前言一、pandas是什么?二、使用步骤1.引入库2.读入数据总结 前言 提示:这里可以添加本文要记录的大概内容: 例如:随着人工智能的不断发展,机器学习这门技术也越来越重要,很多人都开启了学习机器学习,本文就介绍了机器学习的基础内容。 提示:以下是本篇文章正文内容,下面案例可供参考 一、pandas是什么? 示例:pandas 是基于NumPy 的一种工具,该工具是为了解决数据分析任务而创建的。 二、使用步骤 1.引入库 代.

a0310216的博客 2115

efm32 入门.pdf

本PDF共计22页,介绍的是操作驱动API,下载与否自己斟酌。

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

Pytorch 在anaconda环境安装时的问题及解决(CUDA11.2)

CUDA11.2 pytorch 安装问题

mrpig13的博客 1573

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

创建虚拟环境 安装pytorch 并解决jupyter notebook无法找到虚拟环境的问题

安装 pip3 install torch torchvision torchaudio(cpu版本。conda activate pytorchenv 激活。添加虚拟环境pytorchenv。

qq_32936871的博客 464

汉书HE8,好用的汇编代码编写工具

汉书HE8,好用的汇编代码编写工具早期编写汇编代码所用功能强大

上一篇: Pytorch 编码
下一篇: LINUX shell脚本
donglcode
博客等级 码龄10年 26粉丝 10原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值