1. 程式人生 > >安裝Tensorflow後的執行例子報錯解決辦法

安裝Tensorflow後的執行例子報錯解決辦法

安裝好了Tensorflow,執行例子出現如下的錯誤:

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


出現如下的錯誤:

 Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2


解決辦法:

import os

os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'

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