Python 在 Anaconda 上安装特定版本的 tensorflow

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/45425896/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 17:01:14  来源:igfitidea点击:

install tensorflow with specific version on Anaconda

pythontensorflowanacondaconda

提问by user288609

Tensorflow has multiple versions, if I want to install a specific version in Anaconda, which command should I use.

Tensorflow 有多个版本,如果我想在 Anaconda 中安装特定版本,我应该使用哪个命令。

回答by Cardin Lee JH

This is probably the simplest way to do it:

这可能是最简单的方法:

pip install --ignore-installed --upgrade tensorflow==1.4

If you want to see all available versions, you can check out https://pypi.python.org/pypi/tensorflow/json

如果您想查看所有可用版本,可以查看https://pypi.python.org/pypi/tensorflow/json

I would highly recommend you use virtualenvor condato isolate your tensorflow installation, especially if you want to play-test different versions and the CPU/GPU versions.

我强烈建议你使用virtualenvconda隔离你的 tensorflow 安装,特别是如果你想测试不同的版本和 CPU/GPU 版本。

回答by ksai

I am assuming that you are using Windows, python3.5, and CPU versionof tensorflow.

我假设您使用的是Windowspython3.5CPU 版本的 tensorflow。

let's first create conda environment.

让我们首先创建 conda 环境。

C:> conda create -n tensorflow python=3.5 
C:> activate tensorflow
 (tensorflow)C:>  # Your prompt should change 

After creating the conda environment successfully, issue the correct command to install the specific version. I will guide you through installing three different versions.

成功创建conda环境后,发出正确的命令安装特定版本。我将指导您安装三个不同的版本。

To install version r1.0

安装版本 r1.0

(tensorflow)C:> pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.0.1-cp35-cp35m-win_amd64.whl 

To install version r1.3

安装版本 r1.3

(tensorflow)C:> pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.3.0rc1-cp35-cp35m-win_amd64.whl 

To install masterversion

安装master版本

(tensorflow)C:> pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.2.0-cp35-cp35m-win_amd64.whl 

let me know if this is what you are looking for

如果这就是您要找的,请告诉我

回答by adamconkey

I find the existing answers unsatisfying, as the OP asked specifically about Anaconda but the answers are just pip installs.

我发现现有的答案并不令人满意,因为 OP 专门询问了 Anaconda,但答案只是 pip 安装。

You can list the available versions for install doing

您可以列出安装的可用版本

conda search tensorflow-gpu

which should give you some output that looks like

这应该给你一些看起来像的输出

Loading channels: done
# Name                       Version           Build  Channel             
tensorflow-gpu                 1.4.1               0  pkgs/main           
tensorflow-gpu                 1.5.0               0  pkgs/main           
tensorflow-gpu                 1.6.0               0  pkgs/main           
tensorflow-gpu                 1.7.0               0  pkgs/main           
tensorflow-gpu                 1.8.0      h7b35bdc_0  pkgs/main           
tensorflow-gpu                 1.9.0      hf154084_0  pkgs/main           
tensorflow-gpu                1.10.0      hf154084_0  pkgs/main           
tensorflow-gpu                1.11.0      h0d30ee6_0  pkgs/main           
tensorflow-gpu                1.12.0      h0d30ee6_0  pkgs/main           
tensorflow-gpu                1.13.1      h0d30ee6_0  pkgs/main           
tensorflow-gpu                1.14.0      h0d30ee6_0  pkgs/main           
tensorflow-gpu                1.15.0      h0d30ee6_0  pkgs/main           
tensorflow-gpu                 2.0.0      h0d30ee6_0  pkgs/main           
tensorflow-gpu                 2.1.0      h0d30ee6_0  pkgs/main 

Then you can select your version by passing it to the install command, for example:

然后你可以通过将它传递给安装命令来选择你的版本,例如:

conda install tensorflow-gpu==2.0.0

Note this will work the same for tensorflow(i.e. not the GPU version), just change the package name accordingly.

请注意,这对tensorflow(即不是 GPU 版本)同样有效,只需相应地更改包名称。