安装好tensorflow后,用import导入,报错 Process finished with exit code -1073741819 (0xC0000005)

import tensorflow as tf
print(tf.test.is_gpu_available())

一开始想看看安装的tensorflow-gpu是否能运行,但是运行半天,没有得到任何结果,程序结束后终端只返回了Process finished with exit code -1073741819 (0xC0000005)。

解决办法:

更改h5py版本

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple h5py==2.9.0

然后再次运行代码,得到结果:

2023-04-23 20:12:32.624224: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2
2023-04-23 20:12:32.626467: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library nvcuda.dll
2023-04-23 20:12:33.666198: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1640] Found device 0 with properties: 
name: NVIDIA GeForce RTX 2060 major: 7 minor: 5 memoryClockRate(GHz): 1.2
pciBusID: 0000:01:00.0
2023-04-23 20:12:33.666411: I tensorflow/stream_executor/platform/default/dlopen_checker_stub.cc:25] GPU libraries are statically linked, skip dlopen check.
2023-04-23 20:12:33.666572: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1763] Adding visible gpu devices: 0
2023-04-23 20:12:34.145105: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1181] Device interconnect StreamExecutor with strength 1 edge matrix:
2023-04-23 20:12:34.145272: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1187]      0 
2023-04-23 20:12:34.145362: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1200] 0:   N 
2023-04-23 20:12:34.145582: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1326] Created TensorFlow device (/device:GPU:0 with 4724 MB memory) -> physical GPU (device: 0, name: NVIDIA GeForce RTX 2060, pci bus id: 0000:01:00.0, compute capability: 7.5)
True

Process finished with exit code 0
 

 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值