安装tensorflow2.2.0出现 ImportError: DLL load failed,报错内容:from google.protobuf.pyext import _message

————————————2020-8-14更新——————————————

可以直接安装tensorflow2.0(cpu),成功解决protobuf 版本问题

安装命令:

pip install tensorflow==2.0 -i https://pypi.douban.com/simple

测试通过:
在这里插入图片描述

————————————2020-8-5更新——————————————

在执行以下程序时,又遇到了错误,所以问题还没解决

import tensorflow as tf
a = tf.Variable(1.0)

报错:AttributeError: ‘google.protobuf.pyext._message.RepeatedCompositeCo’ object has no attribute ‘append’

前言

  • 安装tensorflow 2.2.0 | cpu 版本 (大概7到8分钟)

    pip install tensorflow-cpu==2.2.0 -i https://pypi.douban.com/simple/
    
  • 安装完成后,import tensorflow报错DLL load failed: 找不到指定的模块,这个报错有好几种情况,请先看你的具体报错内容,再开始找解决办法。

报错内容如下图:from google.protobuf.pyext import _message

from google.protobuf.pyext import _message

在这里插入图片描述

1. 一开始,尝试安装 protobuf==3.6.0

  • 看了一些博客,都是说安装protobuf 3.6.0,安装后发现报版本不兼容问题,tensorflow 2.2.0要求protobuf>=3.8.0,我想应该不行就没尝试import tensorflow

在这里插入图片描述

扫描二维码关注公众号,回复: 13118987 查看本文章

2. 然后,尝试安装protobuf==3.8.0

  • 既然要求要protobuf>=3.8.0,那我就卸了原来的protobuf 3.6.0,装了protobuf 3.8.0,安装完后测试,结果还是报错DLL load failed: 找不到指定的模块

在这里插入图片描述

3. 然后,尝试安装protobuf==3.10.0和 3.12.0

  • 我想3.8.0可能还是有点老,就卸载了原来的,安装了3.10.0和3.12.0,结果还是凉凉,还是报错DLL load failed: 找不到指定的模块

在这里插入图片描述

4. 最后,安装 protobuf==3.6.0

  • 前几个版本都不行,最后决定再试一下protobuf 3.6.0,虽然版本不兼容,也不妨碍我试试,不行的话今天就先睡了。
  • 然后就,就,就成功了!!!

在这里插入图片描述

总结:

  • 安装 protobuf 3.6.0 就行了,不要管它显示的版本不兼容问题

    pip install protobuf==3.6.0
    
  • 中间的卸载包的命令也贴一下

    pip uninstall protobuf
    

猜你喜欢

转载自blog.csdn.net/weixin_44912159/article/details/107761022
今日推荐