python - conda 安装 tensorflow 失败并出现 Python 版本异常

标签 python tensorflow anaconda

我在尝试在 Windows 7 计算机上安装 TensorFlow 时遇到了困难。这是我到目前为止所做的:

> conda config --add channels conda-forge
> activate tensorflow
> conda install tensorflow

导致此异常的原因:

UnsatisfiableError: The following specifications were found to be in conflict: 
- python 3.6*
- tensorflow -> 
- python 3.5*

所以我安装了Python 3.5:

> deactivate py36
> activate py35
> conda install tensorflow

同样的异常。我还尝试从 Python35 目录运行安装命令,但没有成功。

更新 我不会回答我自己的问题,因为有人可能会提出更好的答案。我是一名 .NET 人员,对 Python 比较陌生。这是我所做的:

  1. 通过删除各种安装来清理我的 Python 环境。也许不是实现目标所必需的,但可以缩小问题范围。
  2. 安装了最新版本的 Anaconda。注意:这是一个 Python 3.6 实现。
  3. 创建了我的 TensorFlow 环境:> conda create --name tensorflow python=3.5
  4. 激活新环境:>激活tensorflow
  5. 检查确认:> conda info –envs 运行此命令的结果应该是您的环境列表,在tensorflow环境前面带有星号。 重要说明:从 PowerShell 激活环境不起作用。我必须在命令行窗口中执行此操作。
  6. 按照 TensorFlow 网站上的说明,使用以下命令安装 TensorFlow:pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.1.0-cp35-cp35m-win_amd64.whl

根据最后一行的响应,安装成功:

已成功安装 appdirs-1.4.3 numpy-1.12.1 Packaging-16.8 protobuf-3.3.0 pyparsing-2.2.0 setuptools-35.0.2 六-1.10.0 tensorflow-1.1.0 werkzeug-0.12.2 wh 鳗鱼-0.29.0

我无法让它在 Jupyter 笔记本中工作,但这是另一个 SO 线程的主题。

最佳答案

这对我有用。但那是在 Windows 10 中。 目前,Tensorflow 仅适用于 64 位 Windows,不适用于 32 位。 因此,您可以创建一个新的 64 位环境并在其中安装 TensorFlow:

set CONDA_FORCE_32BIT=
conda create --name name_of_your_created_environment python=3.5
activate name_of_your_created_environment
conda install -c conda-forge tensorflow

CONDA_FORCE_32BIT=1 设置为 32 位环境,而 CONDA_FORCE_32BIT= 设置为 64 位环境。

关于python - conda 安装 tensorflow 失败并出现 Python 版本异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44060062/

相关文章:

anaconda - 元数据可以成为 Orange3 中的目标变量吗?

python - Flask-admin 批处理操作,通过弹出模式窗口进行参数

python - 拆分数据框列,其中 dtype 是 Object 但里面有 list ,如何拆分?

python - 我怎么知道 tensorflow 张量是在 cuda 还是 cpu 中?

javascript - "Dependency was not found"for tfjs in Vue/Webpack project with yarn

python - 使用 tensorflow ,如何平均多个批处理的参数梯度值并使用该平均值进行更新?

python-2.7 - Theano导入错误

python - conda 错误 : Downloaded bytes did not match Content-Length while trying to download cudnn using conda

Python3 ftplib 无法获取更大的二进制文件

python - 如何从 API 获取纯文本?