如何在 anaconda python 3.6 上安装 tensorflow

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/43419795/
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 23:02:14  来源:igfitidea点击:

how to install tensorflow on anaconda python 3.6

pythontensorflowinstallpython-wheel

提问by Muten_Roshi

I installed the new version python 3.6 with the anaconda package. However i am not able to install tensorflow. Always receive the error that

我用 anaconda 包安装了新版本的 python 3.6。但是我无法安装 tensorflow。总是收到错误

tensorflow_gpu-1.0.0rc2-cp35-cp35m-win_amd64.whl is not a supported wheel on this platform.

tensorflow_gpu-1.0.0rc2-cp35-cp35m-win_amd64.whl 在此平台上不受支持。

How can I install tensorflow on anaconda (python 3.6)?

如何在 anaconda (python 3.6) 上安装 tensorflow?

回答by Adriano

UPDATE:TensorFlow supports Python 3.6 on Windows since version 1.2.0 (see the release notes)

更新:TensorFlow 从 1.2.0 版开始支持 Windows 上的 Python 3.6(请参阅发行说明



TensorFlow only supports Python 3.5 64-bit as of now. Support for Python 3.6 is a work in progress and you can track it hereas well as chime in the discussion.

TensorFlow 目前仅支持 Python 3.5 64 位。对 Python 3.6 的支持正在进行中,您可以在此处进行跟踪,也可以在讨论中加入。

The only alternative to use Python 3.6 with TensorFlow on Windows currently is building TF from source.

目前在 Windows 上使用 Python 3.6 和 TensorFlow 的唯一替代方法是从源代码构建 TF。

If you don't want to uninstall your Anaconda distribution for Python 3.6 and install a previous release you can create a conda environment for Python=3.5 as in: conda create --name tensorflow python=3.5 activate tensorflow pip install tensorflow-gpu

如果您不想卸载 Python 3.6 的 Anaconda 发行版并安装以前的版本,您可以为 Python=3.5 创建一个 conda 环境,如下所示: conda create --name tensorflow python=3.5 activate tensorflow pip install tensorflow-gpu

回答by Joshua

This is what I did for Installing Anaconda Python 3.6 version and Tensorflow on Window 10 64bit.And It was success!

这就是我在 Window 10 64bit 上安装 Anaconda Python 3.6 版本和 Tensorflow 所做的事情。它成功了!

  1. Download Anaconda Python 3.6 version for Window 64bit.

  2. Create a conda environment named tensorflow by invoking the following command:

    C:> conda create -n tensorflow 
    
  3. Activate the conda environment by issuing the following command:

    C:> activate tensorflow
    (tensorflow)C:>  # Your prompt should change 
    
  4. Download “tensorflow-1.0.1-cp36-cp36m-win_amd64.whl” from here. (For my case, the file will be located in “C:\Users\Joshua\Downloads” once after downloaded).

  5. Install the Tensorflow by using following command:

    (tensorflow)C:>pip install C:\Users\Joshua\Downloads\ tensorflow-1.0.1-cp36-cp36m-win_amd64.whl
    
  1. 下载适用于 Window 64bit 的 Anaconda Python 3.6 版本

  2. 通过调用以下命令创建一个名为 tensorflow 的 conda 环境:

    C:> conda create -n tensorflow 
    
  3. 通过发出以下命令激活 conda 环境:

    C:> activate tensorflow
    (tensorflow)C:>  # Your prompt should change 
    
  4. 这里下载“tensorflow-1.0.1-cp36-cp36m-win_amd64.whl” 。(就我而言,文件下载后将位于“C:\Users\Joshua\Downloads”中)。

  5. 使用以下命令安装 Tensorflow:

    (tensorflow)C:>pip install C:\Users\Joshua\Downloads\ tensorflow-1.0.1-cp36-cp36m-win_amd64.whl
    

This is what I got after the installing: enter image description here

这是我安装后得到的: 在此处输入图片说明

  1. Validate installation by entering following command in your Python environment:

    import tensorflow as tf
    hello = tf.constant('Hello, TensorFlow!')
    sess = tf.Session()
    print(sess.run(hello))
    
  1. 通过在 Python 环境中输入以下命令来验证安装:

    import tensorflow as tf
    hello = tf.constant('Hello, TensorFlow!')
    sess = tf.Session()
    print(sess.run(hello))
    

If the output you got is 'Hello, TensorFlow!',that means you have successfully install your Tensorflow.

如果你得到的输出是“你好,TensorFlow!”,这意味着你已经成功安装了你的 Tensorflow。

回答by Sandeep Kumar

Simple Way from Scratch.

从头开始的简单方法。

  1. Download Anaconda from https://repo.anaconda.com/archive/Anaconda3-5.2.0-Windows-x86_64.exe

  2. Install Anaconda by double clicking it.

  3. Open anaconda prompt by searching anaconda in windows search and type the following command while being connected to internet.

    A. conda create -n tensorflow_env python=3.6

    B. conda activate tensorflow_env

    C. conda install -c conda-forge tensorflow

  1. https://repo.anaconda.com/archive/Anaconda3-5.2.0-Windows-x86_64.exe下载 Anaconda

  2. 双击安装 Anaconda。

  3. 通过在 Windows 搜索中搜索 anaconda 来打开 anaconda 提示符,并在连接到互联网时键入以下命令。

    一种。 conda create -n tensorflow_env python=3.6

    B. conda activate tensorflow_env

    C。 conda install -c conda-forge tensorflow

Step C will take time. After install type pythonin conda prompt and type

步骤 C 需要时间。安装后输入pythonconda 提示符并输入

import tensorflow as tf

If no error is found your installation is successful.

如果没有发现错误,则说明安装成功。

回答by Ron

According to :https://anaconda.org/intel/tensorflow

根据:https: //anaconda.org/intel/tensorflow

To install this package with conda run:

要使用 conda 安装此软件包,请运行:

conda install -c intel tensorflow

pip install To install this package with pip:

pip install 使用 pip 安装这个包:

pip install -i https://pypi.anaconda.org/intel/simple tensorflow

回答by James

Uninstall Python 3.7 for Windows, and only install Python 3.6.0 then you will have no problem or receive the error message:

卸载 Python 3.7 for Windows,只安装 Python 3.6.0 那么你就没有问题或收到错误信息:

import tensorflow as tf ModuleNotFoundError: No module named 'tensorflow'

将 tensorflow 导入为 tf ModuleNotFoundError:没有名为“tensorflow”的模块

回答by Gabriel

Well, conda install tensorflowworked perfect for me!

嗯,conda install tensorflow非常适合我!

回答by Alexander Vladimirsky

For Windows 10 with Anaconda 4.4 Python 3.6:

对于带有 Anaconda 4.4 Python 3.6 的 Windows 10:

1st step) conda create -n tensorflow python=3.6

第一步) conda create -n tensorflow python=3.6

2nd step) activate tensorflow

第二步) activate tensorflow

3rd step) pip3 install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.2.1-cp36-cp36m-win_amd64.whl

第三步) pip3 install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.2.1-cp36-cp36m-win_amd64.whl

回答by Zaraf

I use this method as told by one of the user: This is what I did for Installing Anaconda Python 3.6 version and Tensorflow on Window 10 64bit.And It was success!

我按照其中一位用户的说法使用了这种方法:这就是我在 Window 10 64bit 上安装 Anaconda Python 3.6 版本和 Tensorflow 时所做的。它成功了!

Go to https://www.continuum.io/downloadsto download Anaconda Python 3.6 version for Window 64bit. Create a conda environment named tensorflow by invoking the following command:

前往https://www.continuum.io/downloads下载适用于 Window 64 位的 Anaconda Python 3.6 版本。通过调用以下命令创建一个名为 tensorflow 的 conda 环境:

C:> conda create -n tensorflow Activate the conda environment by issuing the following command:

C:> conda create -n tensorflow 通过发出以下命令激活 conda 环境:

C:> activate tensorflow (tensorflow)C:> # Your prompt should change Go to http://www.lfd.uci.edu/~gohlke/pythonlibs/entercode here download “tensorflow-1.0.1-cp36-cp36m-win_amd64.whl”. (For my case, the file will be located in “C:\Users\Joshua\Downloads” once after downloaded) Install the Tensorflow by using following command:

C:> activate tensorflow (tensorflow)C:> # 你的提示应该改变 Go to http://www.lfd.uci.edu/~gohlke/pythonlibs/entercode here download “tensorflow-1.0.1-cp36-cp36m- win_amd64.whl”。(就我而言,该文件下载后将位于“C:\Users\Joshua\Downloads”中)使用以下命令安装 Tensorflow:

(tensorflow)C:>pip install C:\Users\Joshua\Downloads\ tensorflow-1.0.1-cp36-cp36m-win_amd64.whl

(tensorflow)C:>pip install C:\Users\Joshua\Downloads\tensorflow-1.0.1-cp36-cp36m-win_amd64.whl

but nothing happens in the prompt. It starts from the new line with the tensorflow as if nothing was written. Whats the problem?

但在提示中没有任何反应。它从带有张量流的新行开始,就好像什么都没写一样。有什么问题?

回答by Farzad Amirjavid

conda create -n tensorflow_gpuenv tensorflow-gpu

conda create -n tensorflow_gpuenv tensorflow-gpu

Or

或者

type the command pip install c:.*.whl in command prompt (cmd).

在命令提示符 (cmd) 中键入命令 pip install c:.*.whl。