pycharm 环境配置常用命令

1.如何查看自己Pycharm里面是否安装torch 以及自己torch cuda cudnn的版本

在pycharm的terminal终端直接输入下列语句

import torch
print(torch.__version__)
print(torch.version.cuda)
print(torch.backends.cudnn.version())

在pycharm里面查看自己的python环境的版本号
terminal终端:
import sys
print(sys.version)

python 3.7.4的环境
在这里插入图片描述

2. you might not have a CUDA gpu

如何判断当前的cuda是否可用

print(torch.cuda.is_available())

显示:表示当前的cuda是不可用的

UserWarning: CUDA initialization: CUDA driver initialization failed, you might not have a CUDA gpu. (Triggered internally at …\c10\cuda\CUDAFunctions.cpp:109.)
return torch._C._cuda_getDeviceCount() > 0

目前

3 .如何查看自己的torch 推荐使用的cuda cudnn

查询官网网址
https://docs.nvidia.com/cuda/cuda-toolkit-release-notes/index.html

4.UserWarning: Error checking compiler version for cl: ‘utf-8’ codec can’t decode byte 0xd3 in positi

定位到报错的那行代码:

然后在decode函数里面添加igonre

line.decode(encoding,"ignore")

然后再创建,就没有报错了。

5.UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0xd3 in position 0: invalid continuation byte

UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0xd3 in position 0: invalid continuation byte

#match = re.search(r'(\d+)\.(\d+)\.(\d+)', compiler_info.decode().strip())
加上 ' gbk'
match = re.search(r'(\d+)\.(\d+)\.(\d+)', compiler_info.decode(' gbk').strip())

6 查看当前cuda的位置,

但是这个打印的电脑的cuda不是python环境里面的cuda
cmd:
在这里插入图片描述
或者在cmd里面直接输入nvcc -V,也是查看windows的cuda版本的方法

7 在当前的pycharm环境里面,print(torch.version.cuda)打印出来的是10.2版本,但是程序一直调用的是10.0版本,也就是根目录,且在根目录没有找到10.2的cuda的安装包

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值