开发环境:
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. LVS解决高并发,大数据量

    http://www.360doc.com/content/14/0726/00/11962419_397102114.shtml LVS的全称Linux vitual system,是由目前阿里巴巴 ...

  2. [译文]Casperjs1.1.0参考文档-快速开始

    快速开始 只要casperjs被正确安装,你就可以开始写你的第一个脚本,你可以使用javascript或者coffiescript编译脚本. 提示: 如果你对javascript不是很熟悉,最好先看专 ...

  3. [hadoop] map函数中使用FileSystem对象出现java.lang.NullPointerException的原因及解决办法

    问题描述: 在hadoop中处理多个文件,其中每个文件一个map. 我使用的方法为生成一个文件,文件中包含所有要压缩的文件在HDFS上的完整路径.每个map 任务获得一个路径名作为输入. 在eclip ...

  4. 190221协程与IO模型

    一.协程 又称微线程 协程是一种用户态的轻量级的线程 在单线程下实现的并发,例如:yield 优点: 无需线程上下文切换的开销 无需原子操作锁定及同步的开销 方便切换控制流,简化编程模型 高并发,高扩 ...

  5. SDUT OJ 3403 数据结构实验之排序六:希尔排序

    数据结构实验之排序六:希尔排序 Time Limit: 1000 ms Memory Limit: 65536 KiB Submit Statistic Discuss Problem Descrip ...

  6. webpack(二)解析es6并打包

    一.前言 ECMAScript 6(ES6)的发展速度非常之快,但现代浏览器对ES6新特性支持度不高,所以要想在浏览器中直接使用ES6的新特性就得借助别的工具来实现.Babel是一个广泛使用的转码器, ...

  7. Qt 学习之路 2(60):使用 DOM 处理 XML

    Qt 学习之路 2(60):使用 DOM 处理 XML  豆子  2013年8月3日  Qt 学习之路 2  9条评论 DOM 是由 W3C 提出的一种处理 XML 文档的标准接口.Qt 实现了 DO ...

  8. Jupyter 安装与应用

    用pip安装Jupyter pip install jupyter 从命令行启动笔记本服务器 jupyter notebook 前提要先启动python,这里有一个 token值,如果不是使用默认浏览 ...

  9. Filezilla 错误

    一般来说,只要网站能访问,FTP就应该能连接的,之前好长一段时间一直遇到连接不上香港主机的问题,还以为是宽带出口线路不好,原来是自己学识浅薄,在同事的指点下才明白所以然,下面总结一下FTP连接中的常见 ...

  10. [转] 一文看懂npm、yarn、pnpm之间的区别

    [From] http://geek.csdn.net/news/detail/197339 原文:Understanding differences between npm, yarn and pn ...