美文网首页
TensorFlow 的安装 (OS X)

TensorFlow 的安装 (OS X)

作者: A07de21s | 来源:发表于2017-06-15 10:43 被阅读0次

step 1. 安装 pip

sudo easy_install pip

确保 pip 版本高于8 如果不是

sudo pip install --upgrade pip

step 2.安装 virtualenv

sudo pip install --upgrade virtualenv 

安装好以后创建工作目录

virtualenv --system-site-packages targetDirectory // targetDirectory 为工作目录

创建好工作目录以后 进入工作目录, 激活沙箱

cd targetDirectory
source bin/activate

step 3. 安装 TensorFlow

pip install --upgrade tensorflow // 自动安装最新版

or

pip install tensorflow==1.1.0 // 安装1.1.0版

step 4.退出沙箱环境

deactivate

在python 环境下

import tensorflow as tf

报错信息为

RuntimeError: module compiled against API version 0xa but this version of numpy is 0x6

说明 numpy 版本不对 需要修改版本 首先进入 Python 环境 导入 numpy

import numpy
print numpy.__path__

得到 numpy 路径后使用 rm -r 删除 numpy 然后重新安装 numpy

进入 python 环境查看 numpy 版本

import numpy
print numpy.__version__

相关文章

网友评论

      本文标题:TensorFlow 的安装 (OS X)

      本文链接:https://www.haomeiwen.com/subject/fuuyqxtx.html