美文网首页
MacOs安装anaconda下tensorflow

MacOs安装anaconda下tensorflow

作者: 追求科技的足球 | 来源:发表于2019-09-18 17:10 被阅读0次

1、下载anaconda并安装
2、创建新的环境:

conda create -n tensorflow python=3.7

3、激活环境:

source activate tensorflow

若退出环境:

source deactivate

4、安装tensorflow

pip install tensorflow

5、此时安装好运行会报错( Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA):
完美解决方法:
在github网站上使用支持AVX2的版本进行安装:
网站链接:https://github.com/lakshayg/tensorflow-build
看好版本后复制下载URL,使用

pip install --ignore-installed --upgrade "URL"

进行安装
6、测试代码:

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

相关文章

网友评论

      本文标题:MacOs安装anaconda下tensorflow

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