一、下載
- 官網(wǎng) https://www.continuum.io/downloads
-
Anaconda
安裝包也可以到 https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/ 下載
image
- 打開,找到4.2版本
image
二雀鹃、安裝Anaconda
- 安裝過程中卓嫂,
Anaconda
會提示是否添加到環(huán)境變量驶赏,選擇“是”;(其實不用太看鳄乏,基本上一直next
到底就好了)
三蔽豺、驗證
- 檢測
python
是否安裝区丑,環(huán)境配置是否成功 - 進入
Anaconda
安裝目錄下的Script
目錄cmd
打開python
image
- 驗證是否安裝成功
- 相關知識插入
TensorFlow
有兩個版本:CPU
版本和GPU
版本。GPU
版本需要CUDA
和cuDNN
的支持修陡,CPU
版本不需要沧侥。如果你要安裝GPU
版本,請先確認你的顯卡支持CUDA
魄鸦。采用pip
安裝方式宴杀,本文安裝cpu
版本
1.確認版本:pip
版本 >= 8.1
2.用pip -V
查看當前pip
版本,用python -m pip install -U pip
升級pip
四拾因、TensorFlow
安裝(安裝的是cpu
版本)
- 以管理員身份運行
cmd
-
cd
到Anaconda下
的Scripts
目錄
cd Program Files\Anaconda3\Scripts
- 輸入:
pip install tensorflow
- 一鍵安裝(
CPU
版)
pip install --upgrade --ignore-installed tensorflow
- 一鍵安裝(
GPU
版)
pip install --upgrade --ignore-installed tensorflow-gpu
五旺罢、測試
- 在
cmd
輸入
python
import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))
- 輸出:
Hello, TensorFlow!
a = tf.constant(10)
b = tf.constant(32)
print(sess.run(a + b))
- 輸出:42
六、配置PyCharm
(最新激活碼)
-
打開—》
file
—》setting
—》
image 在里面新建一個绢记,測試一下: 進入一個交互式
TensorFlow
會話.
import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))
-
結果:
image
七扁达、配置清華源
- 安裝完以后,打開
Anaconda Prompt
蠢熄,輸入清華的倉庫鏡像跪解,更新包更快:
conda config –add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config –set show_channel_urls yes()
關注我的技術公眾號《漫談人工智能》,每天推送優(yōu)質(zhì)文章