tensorflow简介

来自莫凡---强烈推荐莫凡的课程,github,优酷都有啊

什么是tensor flow

TensorFlow是Google开发的一款神经网络的Python外部的结构包, 也是一个采用数据流图来进行数值计算的开源软件库.TensorFlow 让我们可以先绘制计算结构图, 也可以称是一系列可人机交互的计算操作, 然后把编辑好的Python文件 转换成 更高效的C++, 并在后端进行计算.

安装

Linux 和 MacOS

先安装pip

# Ubuntu/Linux 64-位 系统的执行代码:
$ sudo apt-get install python-pip python-dev

# Mac OS X 系统的执行代码:
$ sudo easy_install pip
$ sudo easy_install --upgrade six

CPU 版

# python 2+ 的用户:
$ pip install tensorflow

# python 3+ 的用户:
$ pip3 install tensorflow

GPU版---据说计算速度快很多
如果你想安装 GPU 版的 Tensorflow, 你要在下面找一个适合你版本的安装文件, 并在 terminal 中执行:

# Ubuntu/Linux 64-bit, CPU only, Python 2.7
$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.12.0rc0-cp27-none-linux_x86_64.whl

# Ubuntu/Linux 64-bit, GPU enabled, Python 2.7
# Requires CUDA toolkit 8.0 and CuDNN v5. For other versions, see "Installing from sources" below.
$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-0.12.0rc0-cp27-none-linux_x86_64.whl

# Mac OS X, CPU only, Python 2.7:
$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.12.0rc0-py2-none-any.whl

# Mac OS X, GPU enabled, Python 2.7:
$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/gpu/tensorflow_gpu-0.12.0rc0-py2-none-any.whl

# Ubuntu/Linux 64-bit, CPU only, Python 3.4
$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.12.0rc0-cp34-cp34m-linux_x86_64.whl

# Ubuntu/Linux 64-bit, GPU enabled, Python 3.4
# Requires CUDA toolkit 8.0 and CuDNN v5. For other versions, see "Installing from sources" below.
$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-0.12.0rc0-cp34-cp34m-linux_x86_64.whl

# Ubuntu/Linux 64-bit, CPU only, Python 3.5
$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.12.0rc0-cp35-cp35m-linux_x86_64.whl

# Ubuntu/Linux 64-bit, GPU enabled, Python 3.5
# Requires CUDA toolkit 8.0 and CuDNN v5. For other versions, see "Installing from sources" below.
$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-0.12.0rc0-cp35-cp35m-linux_x86_64.whl

# Mac OS X, CPU only, Python 3.4 or 3.5:
$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.12.0rc0-py3-none-any.whl

# Mac OS X, GPU enabled, Python 3.4 or 3.5:
$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/gpu/tensorflow_gpu-0.12.0rc0-py3-none-any.whl

最后, 根据自己的 python 版本, 在 terminal 中执行以下语句:

# 如果你是 Python 2, 请复制下面
$ sudo pip install --upgrade $TF_BINARY_URL

# 如果你是 Python 3, 请复制下面
$ sudo pip3 install --upgrade $TF_BINARY_URL

Windows

安装前的检查:
目前只支持 Python 3.5 (64bit) 版本
你有安装 numpy

# CPU 版的
C:\> pip install tensorflow

# GPU 版的
C:\> pip install tensorflow-gpu

更新tensflow

根据你的 python 版本, 在 terminal 中删除原有的版本

# 如果你是 Python 2, 请复制下面
pip uninstall tensorflow

# 如果你是 Python 3, 请复制下面
pip3 uninstall tensorflow

然后重复这个安装教程的步骤, 从头安装新版本.

极客学院提供了更为完善的安装方法

基于 Anaconda 的安装
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 1. 介绍 首先让我们来看看TensorFlow! 但是在我们开始之前,我们先来看看Python API中的Ten...
    JasonJe阅读 14,042评论 1 32
  • 网址 下载与安装 你可以使用我们提供的 Pip, Docker, Virtualenv, Anaconda 或 源...
    九七学姐阅读 10,210评论 3 11
  • 1 先讲个段子: 今天北京的雾霾很醇香。 想逃离? 你想多了,高速公路封闭,航班取消,最近一个月火车票都抢光了。不...
    书签客阅读 3,421评论 1 1
  • 一個小男孩獨自一人,走在無盡荒凉的沙漠裡.滿天的黄沙昏暗無光,只能讓人看見十幾米遠的地方. 現在的他又累又餓,...
    HappyAlan阅读 3,561评论 0 0
  • 惠光忽奚落,平凉散四惊 方觉愁暮起,寥寥落余晖 吾卧惜春近,空知返旧林 爱半山浮骨,维扬泪罗巾 汝亦知欲晚,帘卷近...
    路_央1937阅读 1,300评论 0 2