从源代码安装 TensorFlow 和 Tensorboard

Install TensorFlow & Tensorboard from source

我想为 windows 安装 Tensorflow (CPU)(py 3.6),我的公司使用代理,所以我无法通过 pip 安装,我必须从源代码构建它. 我在我的 Anaconda3 文件夹中解压缩 tensorflow/tensorboard/protobuf.tar.gz。

当我使用setup.py文件时,出现安装tensorflow需要tensorboard,安装tensorboard需要tensorflow

所以我不知道如何在不使用 pypi.org 的依赖项的情况下继续安装 Tensorflow。

谢谢

使用 Anaconda 安装

按照以下步骤在 Anaconda 环境中安装 TensorFlow:

  1. Download 并安装 Anaconda。

通过调用以下命令为 运行 版本的 Python 创建名为 tensorflow 的 conda 环境:

$ conda create -n tensorflow

通过发出以下命令激活 conda 环境:

 $ source activate tensorflow

(tensorflow)$  # Your prompt should change 

(tensorflow)$ pip install --ignore-installed --upgrade tfBinaryURL

其中 tfBinaryURL 是 TensorFlow Python package 的 URL。例如,以下命令为 Python 2.7 安装仅 CPU 版本的 TensorFlow:

(tensorflow)$ pip install --ignore-installed --upgrade \ https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.2.1-cp34-cp34m-linux_x86_64.whl

详情offical link

您可以将 pip 与代理一起使用。我也在为公司代理而苦苦挣扎,这就是我的解决方案: 运行 以管理员身份打开命令提示符并键入以下内容:

pip install --proxy http://username:password@proxy_url:port tensorflow

(这将安装最新的 CPU 版本的 tensorflow)

这应该有效。