【CV初接触】win10下anaconda环境中安装tensorflow出错:Failed to load the native TensorFlow和 DLL load failed

初次安装tensorflow,踩了不少坑,折腾了一天才可以运行,记录一下。

首先年少轻狂下载的2.2版本,报的一个错误是
Failed to load the native TensorFlow runtime.

依次换了1.15这个版本和1.13版本,这个错误依然存在,无法解决。最后在1.13版本上,解决了这个错误。

解决方法参照了这里

1、先使用conda upgrade --all 升级所有的包

2、使用Python -m pip install --upgrade pip 或者conda upgrade pip升级pip工具

3、使用conda install tensorflow 安装(因为pip install
TensorFlow安装成功,但是import一直会出现上述问题,虽然TF不对conda上的TF进行维护,但是目前TF1.2版本的已经够用了)

这里
在这里插入图片描述
本质上就是将依赖库重新安装了一下。

————————————————————————————————————————————————————

完成以后再次运行,出现了报错信息如下:DLL load failed: 找不到指定的模块。

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "D:\ProgramFiles\Anaconda\envs\tensorflow\lib\site-packages\tensorflow\__init__.py", line 22, in <module>
    from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import
  File "D:\ProgramFiles\Anaconda\envs\tensorflow\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "D:\ProgramFiles\Anaconda\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "D:\ProgramFiles\Anaconda\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "D:\ProgramFiles\Anaconda\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "D:\ProgramFiles\Anaconda\envs\tensorflow\lib\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 "D:\ProgramFiles\Anaconda\envs\tensorflow\lib\imp.py", line 243, in load_module
    return load_dynamic(name, filename, file)
  File "D:\ProgramFiles\Anaconda\envs\tensorflow\lib\imp.py", line 343, in load_dynamic
    return _load(spec)
ImportError: DLL load failed: 找不到指定的模块。


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.

打开anaconda prompt窗口,输入python进入python环境,再输入import tensorflow也会报相同的错误。

用因为出现了之前的错误,所以这次没有选择更换ts的版本,尝试了网上能搜索道的重装numpy、重装vs等等方法都无法解决。


最后看到了这篇博文,醍醐灌顶。


执行操作:

pip uninstall tensorflow==1.13.0
pip install tensorflow==1.15.0

问题解决。

原因是我的python版本为python 3.7,与过高和过低的版本都不兼容。
————————————————————————————————————————————————————————————

同时,因为下载卸载了太多版本,在使用pip install时会出现这种error,不过好像不影响正常的安装:

ERROR: tensorflow 1.13.1 has requirement tensorboard<1.14.0,>=1.13.0, but you’ll have tensorboard 1.11.0 which is incompatible.

翻译一下就是
tensorflow 1.13.1有要求tensorboard<1.14.0,>=1.13.0,但你会有tensorboard 1.11.0,这是不兼容的。

解决方法是
pip install tensorflow-tensorboard

————————————————————————————————————————————————————————————
总结:由于版本不断更替,anaconda、python、tensorflow三者之间的兼容性直接影响程序能不能运行,运气好的话pip install tensorflow就能完成安装和运行,运气不好的话就会出现各种错误= =安装中出现的问题基本都是环境和兼容性的问题

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值