AI探索(二)Tensorflow环境准备

Python + Tensorflow环境安装

Tensorflow支持Windows/Mac/Linux等三种操作系统, 其中windows下python需要安装3.5以上的版本

Mac/Linux自带的python 2.7可以支持安装Tensorflow

#1. Python安装

这里就不做说明了, 就是windows下记得去设置系统变量

#2. 安装Tensorflow

sudo pip install tensorflow

安装过程中如果提示pip版本需要更新, 更新下pip再重新安装

sudo pip install --upgrade pip

重新安装tensorflow时如果提示某个组件安装报错:

cannot install ''numpy'.It is a distutils installed project and thus we cannot ...

可以使用忽略本地版本单独安装下这个组件

sudo pip install numpy --ignore-installed numpy

其他组件比如six等等如果出现这种错误也是一样操作

然后用升级的方式完成tensorflow的安装

sudo pip install numpy --ignore-installed numpy

#3. 测试tensorflow安装是否成功

在python环境下引入tensorflow库不报错就标识安装成功了

Python 2.7.10 (default, Jul 15 2017, 17:16:57) 
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.31)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
>>> 

猜你喜欢

转载自www.cnblogs.com/zhouxihi/p/10093701.html