mac上安装Tensorflow, python 3 遇到AttributeError: module ‘tensorflow’ has no attribute ‘constant’

不管现实多么惨不忍睹,都要持之以恒地相信,这只是黎明前短暂的黑暗而已。不要惶恐眼前的难关迈不过去,不要担心此刻的付出没有回报,别再花时间等待天降好运。真诚做人,努力做事!你想要的,岁月都会给你。mac上安装Tensorflow, python 3 遇到AttributeError: module ‘tensorflow’ has no attribute ‘constant’,希望对大家有帮助,欢迎收藏,转发!站点地址:www.bmabk.com,来源:原文

mac上安装Tensorflow, python 3 遇到AttributeError: module ‘tensorflow’ has no attribute ‘constant’, 查找了很多资料发现还是不对,最后找到
https://qiita.com/tom_ato/items/bbdf4574b3ecb0048fa1

解决了问题,如果你之前已经安装过tensorflow, python3, 先不需要按照上面的steps来操作,可以直接执行如下命令:

$ sudo easy_install pip
$ sudo easy_install --upgrade six
$ sudo pip install --upgrade pip
$ pip3 install --upgrade tensorflow

看能不能解决你的问题,如果不能解决,你再按照上面链接中的steps来操作,
最后通过如下代码验证:

$ python
>>> import tensorflow as tf
>>> hello = tf.constant('Hello, TensorFlow!')
>>> sess = tf.Session()
>>> print(sess.run(hello))

如果正常输出:“Hello, TensorFlow!” 说明安装TensorFlow成功!
如果出现下面错误:

2019-03-20 17:34:06.194714: I tensorflow/core/platform/cpu_feature_guard.cc:141] You

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

文章由极客之音整理,本文链接:https://www.bmabk.com/index.php/post/164080.html

(0)
飞熊的头像飞熊bm

相关推荐

发表回复

登录后才能评论
极客之音——专业性很强的中文编程技术网站,欢迎收藏到浏览器,订阅我们!