在安装tensorflow之前请阅读官方tensorflow中文社区下载及安装文档。地址是:http://www.tensorfly.cn/tfdoc/get_started/os_setup.html#common_install_problems
安装时我跟随tensorflow社区的安装教程,使用如下命令:
# 仅使用 CPU 的版本
$ pip install https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.5.0-cp27-none-linux_x86_64.whl
# 开启 GPU 支持的版本 (安装该版本的前提是已经安装了 CUDA sdk)
$ pip install https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.5.0-cp27-none-linux_x86_64.whl
但是出现了不支持此平台问题:tensorflow-0.5.0-cp27-none-linux_x86_64.whl is not a supported wheel on this platform.
通过网上寻找问题答案,终于知道tensorflow只能支持64位的操作系统,而我的系统为ubuntu12.04 32位的。
因此马上在虚拟机中更换系统为64位ubuntu16.04,然后继续重新输入如下命令:(我这里就只是安装了CPU版本)
# 仅使用 CPU 的版本
$ pip install https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.5.0-cp27-none-linux_x86_64.whl
# 开启 GPU 支持的版本 (安装该版本的前提是已经安装了 CUDA sdk)
$ pip install https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.5.0-cp27-none-linux_x86_64.whl
但是随后出现了如下问题 :
connectError:错误!
看到红色字明白了连接不成功,由于本机无法连接外网,无法google,所以只能是进行源码安装,或者用迅雷下载。
源码安装在社区下载及安装中可以找到,方法如下。
$ git clone https://github.com/bazelbuild/bazel.git
$ cd bazel
$ git checkout tags/0.1.0
$ ./compile.sh
但是我是利用迅雷进行下载的,下载完后再次pip install /你安装的文件目录
如此就都顺利安装成功了,接下来就继续跟随官方文档学习吧。