在Anaconda3下使用清華鏡像源安裝TensorFlow(CPU版)
1、打開(kāi)AnacondaPrompt

2、搭建TensorFlow的環(huán)境:
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

環(huán)境搭建完成:

4、安裝(CPU)版的TensorFlow:
// 啟動(dòng)TensorFlow: activate tensorflow


5、測(cè)試TensorFlow是否安裝完成
終端進(jìn)入python:
輸入:
import tensorflow as tf
hello = tf.constant("hello, tensorflow!")
sess = tf.Session()
print(sess.run(hello))
輸出: b'hello, tensorflow!',即成功!??!
6、在Jupiter中使用TensorFlow
準(zhǔn)備工作:
安裝ipython,安裝jupyter
conda install ipython conda install jupyter
輸入:
ipython kernelspec install-self --user
看到類(lèi)似這個(gè)結(jié)果 Installed kernelspec python3 in C:\Users\XXX\Jupyter\kernels\python3即可以了!
打開(kāi)AnacondaJupiter稍等一會(huì)

復(fù)制網(wǎng)址,瀏覽器打開(kāi)

新建python3文件
輸入:
import tensorflow as tf tf.__version__
輸出:

即安裝成功!
7、安裝成功后,每次使用 TensorFlow 的時(shí)候都需要激活 conda 環(huán)境
//查看環(huán)境 conda info --envs //激活環(huán)境 activate tensorflow //關(guān)閉環(huán)境 deactivate tensorflow
到此這篇關(guān)于在Anaconda3下使用清華鏡像源安裝TensorFlow(CPU版) 的文章就介紹到這了,更多相關(guān)Anaconda3安裝TensorFlow(CPU版) 內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
python 使用openpyxl讀取excel數(shù)據(jù)
Python3.6.x中內(nèi)置函數(shù)總結(jié)及講解
Python?print函數(shù):如何將對(duì)象打印輸出
pandas中concatenate和combine_first的用法詳解
Python使用Selenium實(shí)現(xiàn)模擬登錄的示例代碼
使用Docker部署Python的Flask項(xiàng)目最新教程

