TensorFlow1.14.0版本出现ImportError

使用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

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容