tensorflow 源码安装(for MacOS)

本文详细介绍了如何在MacOS上通过源码编译安装TensorFlow,以解决CPU计算时缺少SSE4.1、SSE4.2、AVX、AVX2和FMA指令的问题。首先,通过git克隆TensorFlow源码,然后安装bazel和Python依赖。接着,配置环境并运行configure脚本,根据提示选择相应的支持项。最后,使用bazel编译并创建pip包进行安装,成功后可以加快CPU计算速度。
摘要由CSDN通过智能技术生成

install tensorflow from sources for MacOS

运行tensorflow时经常遇到如下问题:

The TensorFlow library wasn’t compiled to use SSE4.1/SSE4.2 /AVX/AVX2/FMA instructions, but these are available on your machine and could speed up CPU computations

于是好奇就想尝试通过tensorflow源码安装解决这个问题

先说一下我的电脑系统版本:macOS sierra version 10.12.6  不带独显所以我装的是cpu版本的tensorflow

下面就是叙述一下安装步骤和我在安装过程中遇到的一些问题:

1. 先把tensorflow源码下载(clone the tensorflow repository)

$ git clone https://github.com/tensorflow/tensorflow

$ cd tensorflow

$ git checkout Branch # where Branch is the desired branch

2. 配置环境(prepare environment for MacOS)

在安装tensorflow之前,必须先安装bazel和python依赖包(six numpy wheel)

利用homebrew安装bazel,先安装JDK 8和homebrew, 这两个我很早就安装了就不叙述了

利用brew安装bazel如下:

brew install bazel 

bazel version

brew upgrade bazel

install python dependencies

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值