TensorFlow
是一個端到端開源機器學習平臺。它擁有一個包含各類工具、庫和社區資源的全面靈活生態系統,能夠讓研究人員推進機器學習領域的先進技術的。python
TensorFlow
安裝的前提是系統安裝了 Python 2.5 或更高版本,教程中的例子是以 Python 3.6(Anaconda 3 版)爲基礎設計的。爲了安裝 TensorFlow
,首先確保你已經安裝了 Anaconda。能夠從網址(https://www.anaconda.com/distribution/#download-section)中下載並安裝適用於 Windows/macOS 或 Linux 的 Anaconda。程序員
這個是
macos
的鏈接,一個是命令行的,一個是GUI的macoshttps://repo.anaconda.com/archive/Anaconda3-2019.10-MacOSX-x86_64.shapi
https://repo.anaconda.com/archive/Anaconda3-2019.10-MacOSX-x86_64.pkgbash
關於安裝 anaconda
, 能夠參考官方的文檔。機器學習
執行這個命令source ~/.bash_profile
, 其實查看這個文件.bash_profile
,關鍵的信息export PATH="/opt/anaconda3/bin:$PATH"
,就是配置anaconda的環境變量。 而後執行conda -V
學習
(base) ➜ OpenSource conda -V
conda 4.7.12google
這一步能夠省略,可是配置爲國內的源以後,速度快的飛起來。 sudo vi /Users/
username/Library/Application\ Support/pip/pip.conf
,而後修改裏面的內容爲下面的源。url
[global] index-url = https://pypi.tuna.tsinghua.edu.cn/simple/ [install] trusted-host=pypi.tuna.tsinghua.edu.cn
保存退出便可。
當前版本只支持 CPU
pip install https://storage.googleapis.com/tensorflow/mac/tensorflow-0.5.0-py2-none-any.whl
或者乾脆直接用pip install tensorflow
同樣的。
這是第一個程序
import tensorflow as tf hello = tf.constant('Hello, TensorFlow!') sess = tf.Session() print(sess.run(hello)) # Hello, TensorFlow!
若是你感興趣能夠關注公衆號「chasays」- 程序員匯聚地