TensorFlow兩種搭建方式。
———————————————————————————————————————————————
第一種方式是Anaconda環境配置
1.Anaconda官網下載anaconda最新版本即可:Anaconda官網
———————————————————————————————————————————————
2.下載好後打開安裝包,除了更改路徑,和下圖勾選部分,其餘一路next,下圖勾選部分,兩個選項都勾選。
———————————————————————————————————————————————
3.添加tensorflow環境,在該環境裏添加tensorflow
———————————————————————————————————————————————
4.同樣方法安裝安裝jupyter notebook
———————————————————————————————————————————————
5.打開jupyter notebook,創建一個python文件驗證安裝是否正確
import tensorflow as tf
hello = tf.constant("hello, tensorflow!")
sess = tf.Session()
print(sess.run(hello))
hello, tensorflow!
———————————————————————————————————————————————
第二種方式是pycharm
———————————————————————————————————————————————
1.官網下載pycharm:pycharm官網
官網下載python3:python官網
———————————————————————————————————————————————
2.安裝pycharm,一路默認即可
———————————————————————————————————————————————
3.安裝python3,路徑自己選,勾選添加環境變量,其餘一路默認即可
———————————————————————————————————————————————
4.安裝tensorflow模塊,打開cmd窗口,輸入:pip install tensorflow
———————————————————————————————————————————————
5.在pycharm中新建.py文件,helloworld 驗證安裝是否正確。
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
import tensorflow as tf
import tensorflow as tf
hello = tf.constant("Hello,TensorFlow")
a = tf.constant(10)
b = tf.constant(20)
sess = tf.Session()
print(sess.run(hello))
print(sess.run(a + b))
sess.close()
如果輸出
b'Hello,TensorFlow'
30
———————————————————————————————————————————————
恭喜你,大功告成,開啓你的tensorflow學習之旅吧!
有興趣的可以加python深度學習羣 : 837735613