美文网首页
TensorFlow1.14.0版本出现ImportError

TensorFlow1.14.0版本出现ImportError

作者: 马小李23 | 来源:发表于2020-04-26 11:15 被阅读0次

使用TensorFlow 1.14.0版本,出现报错

ImportError: DLL load failed: The specified module could not be found. Failed to load the native TensorFlow runtime. See https://www.tensorflow.org/install/errors for some common reasons and solutions. Include the entire stack trace above this error message when asking for help.

但是在cmd中,运行python,然后直接import tensorflow as tf不报错,并且能正常创建Session,而且成功运行,多次尝试后发现,这个问题发生在以下情况中:

# main.py文件中
import utils
# utils.py文件中
import tensorflow as tf

那么这种的import就会报错,解决的办法也很简单:
在main.py文件中import tensorflow即可(就是运行的py文件中,一开始就import tensorflow)
或者:将python的版本换成python3.6
出错版本:python3.5.3 tensorflow1.14.0
未出错版本:python3.6.8 tensorflow1.14.0
cuda 10.0 cuDNN 7.4.1.5

相关文章

网友评论

      本文标题:TensorFlow1.14.0版本出现ImportError

      本文链接:https://www.haomeiwen.com/subject/tardwhtx.html