tensorflow安裝

1.安裝Anaconda

sudo chmod Anaconda2-5.3.0-Linux-x86_64.sh
./Anaconda2-5.3.0-Linux-x86_64.sh
  • 第一個yes繼續
  • 第二個no不安裝VS code

2.安裝tensorflow

  • 按照 Anaconda 下載網站上的說明下載並安裝 Anaconda。
  • 通過調用以下命令創建名爲 tensorflow 的 conda 環境,以運行某個版本的 Python:
$ conda create -n tensorflow pip python=2.7 # or python=3.3, etc.
  • 通過發出以下命令激活 conda 環境:
$ source activate tensorflow
 (tensorflow)$  # Your prompt should change 
  • 發出以下格式的命令以在 conda 環境中安裝 TensorFlow:
(tensorflow)$ pip install --ignore-installed --upgrade tfBinaryURL
  • 其中 tfBinaryURL 是 TensorFlow Python 軟件包的網址。例如,以下命令將針對 Python 2.7 安裝僅支持 CPU 的 TensorFlow 版本:
 (tensorflow)$ pip install --ignore-installed --upgrade https://download.tensorflow.google.cn/linux/cpu/tensorflow-1.8.0-cp27-none-linux_x86_64.whl

3.tensorflow測試

  • 激活tensorflow環境
source activate tensorflow
  • 從 shell 中調用 Python,如下所示:
$ python
  • 在 Python 交互式 shell 中輸入以下幾行簡短的程序代碼:
# Python
import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))

4.額外的工具包安裝

 python -m pip install  matplotlib
 python -m pip install  sklearn
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章