在Anaconda3下使用清華映象源安裝TensorFlow(CPU版)
阿新 • • 發佈:2020-04-20
1、開啟AnacondaPrompt
2、搭建TensorFlow的環境:
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ conda config --set show_channel_urls yes conda create -n tensorflow python=3.5
3、在使用者目錄下找到檔案 .condarc
環境搭建完成:
4、安裝(CPU)版的TensorFlow:
// 啟動TensorFlow: activate tensorflow
5、測試TensorFlow是否安裝完成
終端進入python:
輸入:
import tensorflow as tf hello = tf.constant("hello,tensorflow!") sess = tf.Session() print(sess.run(hello))
輸出: b'hello,tensorflow!',
即成功!!!
6、在Jupiter中使用TensorFlow
準備工作:
安裝ipython,安裝jupyter
conda install ipython conda install jupyter
輸入:
ipython kernelspec install-self --user
看到類似這個結果 Installed kernelspec python3 in C:\Users\XXX\Jupyter\kernels\python3即可以了!
開啟AnacondaJupiter稍等一會
複製網址,瀏覽器開啟
新建python3檔案
輸入:
import tensorflow as tf tf.__version__
輸出:
即安裝成功!
7、安裝成功後,每次使用 TensorFlow 的時候都需要啟用 conda 環境
//檢視環境 conda info --envs //啟用環境 activate tensorflow //關閉環境 deactivate tensorflow
到此這篇關於在Anaconda3下使用清華映象源安裝TensorFlow(CPU版) 的文章就介紹到這了,更多相關Anaconda3安裝TensorFlow(CPU版) 內容請搜尋我們以前的文章或繼續瀏覽下面的相關文章希望大家以後多多支援我們!