linux安装pytorch出现torch.cuda.is_available() False的解决办法汇总

说在开头的话:红色表示亲测可用,绿色表示本人测试未通过,蓝色表示未测试,同学测试完其他的可用,可以留言!

有人说是CUDA版本太高,而没有对应的Pytorch版本,导致不能兼容,故而失败,我也在尝试中。。。

本人nvidia-smi信息 现在是False

(base) wangbin@wangbin-ZHENGJIUZHE-REN9000K-34IMZ:~$ nvidia-smi
Fri Nov 20 09:57:00 2020       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 455.38       Driver Version: 455.38       CUDA Version: 11.1     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  GeForce RTX 3080    Off  | 00000000:01:00.0  On |                  N/A |
| 30%   27C    P8    22W / 320W |    177MiB / 10011MiB |      2%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|    0   N/A  N/A       993      G   /usr/lib/xorg/Xorg                 95MiB |
|    0   N/A  N/A      1605      G   cinnamon                           19MiB |
|    0   N/A  N/A     23533      G   ...AAAAAAAAA= --shared-files       59MiB |
+-----------------------------------------------------------------------------+
 

搞定了,其实我的nvidia-smi显示出来cuda的版本是11.1,但是我通过cuda list查找并没有看到cuda,不知道是怎么回事。

添加了一个清华源,   https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free

conda config --set show_channel_urls yes

我将anconda彻底卸载了按照(https://blog.csdn.net/qq_22474567/article/details/54984257#commentBox),

然后重新装了一遍,然后进入官网(https://pytorch.org/get-started/locally/)根据人家所给命令下载

conda install pytorch torchvision torchaudio cudatoolkit=11.0 -c pytorch

就成功了,感觉如果不成功,可以先将anaconda先彻底卸载了再装一遍,也许就好了。

(first_env) wangbin@wangbin-ZHENGJIUZHE-REN9000K-34IMZ:~/Desktop$ python
Python 3.8.5 (default, Sep  4 2020, 07:30:14) 
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> torch
<module 'torch' from '/home/wangbin/anaconda3/envs/first_env/lib/python3.8/site-packages/torch/__init__.py'>
>>> print(torch.cuda.is_available())
True
 

 

 

https://blog.csdn.net/qq_22474567/article/details/54984257#commentBox

linux上anaconda的卸载

同学A:我在运行第三步后,出现#export: command not found错误,是为什么呢

同学A回复:哈哈,我来自问自答吧.我的错误是第二步修改文件没有成功导致的,重新转到第一步进入bashrc文件,我的bashrc文件里面是if...else \export... fi ,这里需要把else和\export两行都注释掉,也就是在前面加#号

 

Ubuntu 20.04 CUDA&cuDNN安装方法

https://blog.csdn.net/ashome123/article/details/105822040#commentBox

 

 

https://blog.csdn.net/xq_nbu/article/details/83188570#commentBox

安装了anaconda不需要安装cuda和cudnn!    ->这个貌似有用

 

torch.cuda.is_available()返回False,但nvidia-smi正常

https://spring-quan.github.io/2019/04/16/torch-cuda-is-available-%E8%BF%94%E5%9B%9EFalse-%E4%BD%86nvidia-smi%E6%AD%A3%E5%B8%B8/

 

Ubuntu安装和卸载CUDA和CUDNN

https://blog.csdn.net/qq_33200967/article/details/80689543#commentBox

 

https://www.cnblogs.com/yhjoker/p/10972795.html

Pytorch 使用不同版本的 cuda

 

https://www.jianshu.com/p/3c75176e7d8b

Linux下安装anaconda,Pytorch,tensorflow

 

Linux设置anaconda的环境变量

https://blog.csdn.net/m0_37041325/article/details/77169972

 

安装pytorch出现torch.cuda.is_available() False

https://blog.csdn.net/liu16659/article/details/105163179#commentBox

 

https://blog.csdn.net/lwgkzl/article/details/89329383

两行代码下载安装Anaconda(linux环境)

 

https://blog.csdn.net/qq1483661204/article/details/78201451#commentBox

linux下Anaconda的安装

  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

程序猿的探索之路

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

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

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

打赏作者

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

抵扣说明:

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

余额充值