python报错:ImportError: cannot import name ‘_tf_stack‘ from ‘tensorflow.python‘

ImportError: cannot import name ‘_tf_stack’ from ‘tensorflow.python’

本来keras和tensorflow用得好好的,忽然今天报错导入包得时候直接报错。在网上找了很多方法,但是用处都不大,尝试了很多遍都不行。于是尝试将tensorflow和keras卸载重装。(需要彻底卸载,pip命令后还需要删除文件夹中得几个文件夹,也就是在python的安装目录下的lib文件夹下的site-packages文件夹下的tensorflow,keras文件夹),然后将之前的tensorflow得版本提高一些,keras的版本降低一些。(我原本是tensorflow1.13和keras2.3.1,重装之后tensorflow1.14和keras2.2.1),重装之后正常使用。

仅供参考

Traceback (most recent call last): File "train.py", line 13, in <module> import tensorflow as tf File "/home/nvidia/anaconda3/envs/deephdr/lib/python3.6/site-packages/tensorflow/__init__.py", line 24, in <module> from tensorflow.python import * File "/home/nvidia/anaconda3/envs/deephdr/lib/python3.6/site-packages/tensorflow/python/__init__.py", line 49, in <module> from tensorflow.python import pywrap_tensorflow File "/home/nvidia/anaconda3/envs/deephdr/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 74, in <module> raise ImportError(msg) ImportError: Traceback (most recent call last): File "/home/nvidia/anaconda3/envs/deephdr/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module> from tensorflow.python.pywrap_tensorflow_internal import * File "/home/nvidia/anaconda3/envs/deephdr/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module> _pywrap_tensorflow_internal = swig_import_helper() File "/home/nvidia/anaconda3/envs/deephdr/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description) File "/home/nvidia/anaconda3/envs/deephdr/lib/python3.6/imp.py", line 242, in load_module return load_dynamic(name, filename, file) File "/home/nvidia/anaconda3/envs/deephdr/lib/python3.6/imp.py", line 342, in load_dynamic return _load(spec) ImportError: libcublas.so.9.0: cannot open shared object file: No such file or directory Failed to load the native TensorFlow runtime. See https://www.tensorflow.org/install/install_sources#common_installation_problems for some common reasons and solutions. Include the entire stack trace above this error message when asking for help.
最新发布
03-15
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

Echo_Wish

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

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

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

打赏作者

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

抵扣说明:

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

余额充值