1. 程式人生 > >Deep Learning_0 Tensorflow開發環境配置(基於python)

Deep Learning_0 Tensorflow開發環境配置(基於python)

deep learning之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 在這裡插入圖片描述

在這裡插入圖片描述