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」- 程序员汇聚地