开发环境:
mac os 10.12.5
Python 2.7.10
GCC 4.2.1

mac默认是不带pip的,安装pip。

sudo easy_install pip

1.安装virtualenv

sudo pip install virtualenv --upgrade

创建一个工作目录:

sudo virtualenv --system-site-packages ~/tensorflow

进行该目录,激活沙箱

cd ~/tensorflow

source bin/activate

2.virtualenv里安装TensorFlow

进入沙箱后,执行下面的命令来安装TensorFlow:

(tensorflow)$ sudo pip install tensorflow==1.2.1

3.运行TensorFlow

...

environment /Users/***/tensorflow

Successfully installed backports.weakref-1.0rc1 bleach-1.5.0 funcsigs-1.0.2 html5lib-0.9999999 markdown-2.6.8 mock-2.0.0 numpy-1.13.0 pbr-3.1.1 protobuf-3.3.0 six-1.10.0 tensorflow-1.2.1 werkzeug-0.12.

hello world测试一下:

$ python
Python 2.7.10 (default, Feb 7 2017, 00:08:15)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.34)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> import tensorflow as tf
>>> hello =tf.constant('hello world!')
>>> sess = tf.Session()
2017-07-05 23:58:34.771619: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
2017-07-05 23:58:34.771654: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
2017-07-05 23:58:34.771663: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations.
2017-07-05 23:58:34.771671: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations.
>>> print sess.run(hello)
hello world!

恭喜,TensorFlow安装成功了。

*每次运行TensorFlow程序时,都需要进入tensorflow目录,然后执行source bin/activate 命令来激活沙箱。

*Ubuntu/Linux也可以按Mac os准备。TensorFlow安装版本分为CPU版和GPU版,区别在于:

(tensorflow)$ sudo pip install tensorflow==1.2.1

(tensorflow)$ sudo pip install tensorflow-gpu==1.2.1

TensorFlow入门:mac 安装 TensorFlow的更多相关文章

  1. mac安装tensorflow报错

    问题:mac安装tensorflow过程中,爆出oserror:permission denied 解决方案:关闭mac的sip,然后sudo安装 关闭sip的方法:重启mac,按住command+R ...

  2. mac安装tensorflow

    tensorflow简介 TensorFlow是谷歌基于DistBelief进行研发的第二代人工智能学习系统,其命名来源于本身的运行原理.Tensor(张量)意味着N维数组,Flow(流)意味着基于数 ...

  3. Mac 安装tensorflow

    一. 安装 TensorFlow谷歌的官网和开源项目都有介绍各个系统的安装和使用(官网:https://www.tensorflow.org/install git: https://github.c ...

  4. AI mac安装TensorFlow

    1.安装pip sudo easy_install pip 2.安装virtualenv sudo pip install --upgrade virtualenv 3.在指定目录创建virtuale ...

  5. tensorflow入门——5tensorflow安装

    你将把你学到的神经网络的知识,借助 TensorFlow ,一个 Google 开源的深度学习框架,应用在真实的数据集中. 你将使用 TensorFlow 来辨别 notMNIST 数据集.它是一个由 ...

  6. 【tensorflow】1.安装Tensorflow开发环境,安装Python 的IDE--PyCharm

    ================================================== 安装Tensorflow开发环境,安装Python 的IDE--PyCharm 1.PyCharm ...

  7. Tensorflow入门(安装)

    TensorFlow是将复杂的数据结构传输至人工智能神经网中进行分析和处理过程的系统.主要用于深度学习(神经网络)方面的研究与应用.Tensorflow适用与Python.C++.Java,本博客中主 ...

  8. TensorFlow入门:安装常用的依赖模块

    TensorFlow运行中常用到一些Python第三方模块: numpy 存储和处理大型矩阵的科学计算包 maplotlib 最著名的绘图库 jupyter scikit-image 图像预处理 li ...

  9. 【Tensorflow】Ubuntu 安装 Tensorflow gpu

    安装环境:Ubuntu 16.04lts 64位,gcc5.4 1.安装Cuda 1. 下载cuda toolkit. 下载cuda8.0 地址:https://developer.nvidia.co ...

随机推荐

  1. 1. UML统一建模语言

    (1)UML概述: 建模: 对现实系统进行适当的过滤, 用适当的表现规则描述出简洁的模型. 建模是一种深入解决问题的方法. UML: UML(United Modeling Language, 统一建 ...

  2. 使用原生实现jquery中的css方法

    由于jquery放在mobile页面上,有时候还是显得有点大,所以今天尝试使用原生来开发,但是习惯了jquery之后,转用原生开发之后,发现原生中,找不到可以替代jquery的css方法,于是对原生的 ...

  3. 条目八《永不建立auto_ptr的容器》

    条目八<永不建立auto_ptr的容器> 重要的事说三次,永不建立auto_ptr的容器,永不建立auto_ptr的容器,永不建立auto_ptr的容器!!! 为什么? 实质是auto_p ...

  4. Qt 学习之路 2(47):视图选择

    Qt 学习之路 2(47):视图选择 豆子 2013年3月28日 Qt 学习之路 2 34条评论 选择是视图中常用的一个操作.在列表.树或者表格中,通过鼠标点击可以选中某一项,被选中项会变成高亮或者反 ...

  5. flask总结03

    一:flask的请求勾子 01:钩子概念说明: 在客户端和服务器交互的过程中,有些准备工作或扫尾工作需要处理,比如: 在请求开始时,建立数据库连接: 在请求开始时,根据需求进行权限校验: 在请求结束时 ...

  6. css类选择器中 空格 逗号 啥都不填的区别及其他笔记

    .a.b 代表 一个元素上 同时 有 a 类 和 b 类 .a .b (中间有空格) 代表 .b 是 .a 的子元素选择. .a,.b 代表 class='a' 和 class='b' 都会被选择上.

  7. wepsocket 了解一下

    WebSocket协议是基于TCP的一种新的协议.WebSocket最初在HTML5规范中被引用为TCP连接,作为基于TCP的套接字API的占位符.它实现了浏览器与服务器全双工(full-duplex ...

  8. 压缩感知(CS)

    总结一下最近看的压缩感知(Compressed Sensiong)的内容. 它是在采样过程中完成了数据压缩的过程. 一. 将模拟信号转换为计算机能够处理的数字信号,必然要经过采样的过程.问题在于,应该 ...

  9. C# Win7下隐藏手势提示

    点击这里是原版答案 Stylus.IsFlicksEnabled="False" 手势是什么样子的

  10. Advanced Data Structures in competitive programming

    1.bit #define isOn(S, j) (S & (1 << j)) #define setBit(S, j) (S |= (1 << j)) #define ...