Installing tensorflow with anaconda in windows

前端 未结 20 2249
春和景丽
春和景丽 2020-12-08 02:15

I have installed Anaconda on Windows 64 bit. I have downloaded PyCharm for creating a project and in the terminal of PyCharm I have installed numpy, scipy

相关标签:
20条回答
  • 2020-12-08 03:13

    To install TF on windows, follow the below-mentioned steps:

    conda create --name tensorflow python=3.5
    activate tensorflow
    conda install jupyter
    conda install scipy
    pip install tensorflow-gpu
    

    Use pip install tensorflow in place of pip install tensorflow-gpu, in case if you want to install CPU only version of TF.

    Note: This installation has been tested with Anaconda Python 3.5 (64 bit). I have also tried the same installation steps with (a) Anaconda Python 3.6 (32 bit), (b) Anaconda Python 3.6 (64 bit), and (c) Anaconda Python 3.5 (32 bit), but all of them (i.e. (a), (b) and (c) ) failed.

    0 讨论(0)
  • 2020-12-08 03:13

    Currently tensorflow has binaries only for Unix based OS i.e. Ubuntu Mac OS X - that's why no mention of Windows in setup docs.

    There are long discussions on Github:

    • Open - Windows Support and Documentation
    • Closed - How to install TensorFlow on Windows
    • Closed - How to install/run/use TensorFlow on windows machines?

    A SO answer - tensorflow — is it or will it (sometime soon) be compatible with a windows workflow?


    Suggestion:

    For now, on Windows, the easiest way to get started with TensorFlow would be to use Docker: http://tensorflow.org/get_started/os_setup.md#docker-based_installation

    It should become easier to add Windows support when Bazel (the build system we are using) adds support for building on Windows, which is on the roadmap for Bazel 0.3. You can see the full Bazel roadmap here.

    Or simply use a Linux VM (using VMPlayer), and the stated steps will setup it up for you.


    For PyCharm - Once conda environment will be created, you'll need to set the new interpretor (in conda environment) as the interpretor to use in PyCharm:

    Now to use the conda interpreter from PyCharm go to file > settings > project > interpreter, select Add local in the project interpreter field (the little gear wheel) and browse the interpreter or past the path.

    The default location - the environment lives under conda_root/envs/tensorflow. The new python interpreter 'll be at conda_root/envs/tensorflow/bin/pythonX.X , such that the site-packages will be in conda_root/envs/tensorflow/lib/pythonX.X/site-packages.

    0 讨论(0)
  • 2020-12-08 03:15

    I have python 3.5 with anaconda. First I tried everything given above but it did not work for me on windows 10 64bit. So I simply tried:-

    1. Open the command prompt
    2. Check for python version for which you want to install tensorflow, if you have multiple versions of python.
    3. If you just have one version, then type in cmd:

      C:/>conda install tensorflow 
      

      for multiple versions of python, type in cmd:

      C:/>conda install tensorflow python=version(e.g.python=3.5)
      

    It works, just give it a try.
    After installation open ipython console and import tensorflow:

    import tensorflow
    

    If tensorflow installed properly then you are ready to go. Enjoy machine learning:-)

    0 讨论(0)
  • 2020-12-08 03:17

    This worked for me:

    conda create -n tensorflow python=3.5
    activate tensorflow
    conda install -c conda-forge tensorflow
    

    Open Anaconda Navigator.

    Change the dropdown of "Applications on" from "root" to "tensorflow"

    see screenshot

    Launch Spyder

    Run a little code to validate you're good to go:

    import tensorflow as tf
    node1 = tf.constant(3, tf.float32)
    node2 = tf.constant(4) # also tf.float32 implicitly
    print(node1, node2)
    

    or

    hello = tf.constant('Hello, TensorFlow!')
    sess = tf.Session()
    print(sess.run(hello))
    
    0 讨论(0)
  • 2020-12-08 03:18

    The following command from inside your command window (and preferably, conda environment) will work provided you have an Nvidia graphics card.

    conda install tensorflow-gpu 
    
    0 讨论(0)
  • 2020-12-08 03:18

    If you have anaconda version 2.7 installed on your windows, then go to anaconda prompt, type these two commands:

    1. Create a conda environment for tensorflow using conda create -n tensorflow_env tensorflow
    2. activate the tensorflow using conda activate tensorflow_env

    If it is activated, then the base will be replaced by tensorflow_env i.e. now it will show (tensorflow_env) C:\Users>

    You can now use import tensorflow as tf for using tensorflow in your code.

    0 讨论(0)
提交回复
热议问题