1.測試cpu版本的TensorFlow
重新打開Anaconda Prompt
—>activate tensorflow
—>python
來啓動tensorflow,並進入python環境
(I:\lunwen\Anaconda3) C:\Users\XXX>activate tensorflow
(tensorflow) C:\Users\XXX>python
Python 3.5.4 |Continuum Analytics, Inc.| (default, Aug 14 2017, 13:41:13) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
測試代碼:
#TensorFlow使用圖(Graph)來表示計算任務;並使用會話(Session)來執行圖,通過Session.close()來關閉會話(這是一種顯式關閉會話的方式)。會話方式有顯式和隱式會話之分。
import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!') #初始化一個TensorFlow的常量
sess = tf.Session() #啓動一個會話
print(sess.run(hello))
2.問題1
當我們用Anaconda自帶的iPython和Spyder以及jupyter notebook中輸入import tensorflow as tf
的時候會失敗,顯示如下No module named 'tensorflow‘
,原因是我們沒有在TensorFlow的環境下打開它們。
爲此,我們需要在TensorFlow環境下安裝這兩個插件。
- 打開
Anaconda Navigator
—>Environments
—>tensorflow
,選擇Not installed
,找到iPython和Spyder以及jupyter並安裝。
好的,安裝好三個插件後,我們用例子分別來運行試試(都要事先activate tensorflow
來啓動tensorflow):
ipython:
Spyder:
立刻喚醒Spyder
,並運行:
jupyter notebook:
轉載自:https://www.cnblogs.com/HongjianChen/p/8385547.html
3.使用anaconda中的spyder對.py文件進行調試
- 首先,對spyder界面知識有所瞭解,參照以下鏈接:
https://blog.csdn.net/fu6543210/article/details/79772093(轉載鏈接)
https://blog.csdn.net/chengqiuming/article/details/79937938(轉載鏈接)
4.tensorflow基礎瞭解
官網鏈接:https://www.tensorflow.org/
tensorflow中文社區:http://www.tensorfly.cn/
網上資源:
博主:zhaozhengcoder,https://www.jianshu.com/p/27a2fb320934
介紹了其自己學習歷程,以及牛人的知識分享
tensorflow信息網站:http://www.tensorflownews.com/
機器學習速成課程:https://developers.google.cn/machine-learning/crash-course/