Install tensorflow on Windows with anaconda

后端 未结 7 1612
夕颜
夕颜 2021-01-11 19:50

I am trying to install Tensorflow on my Windows PC. Since I have already install and used Anaconda on Python (3.5), I have followed the instructions https://www.tensorflow.o

7条回答
  •  太阳男子
    2021-01-11 20:37

    The above provided steps will install the TensorFlow in your Windows System but still you might face problem in making it available in your Jupyter notebook - hence integrating steps from different places together to have a complete solution:

    How to install Tensorflow in Anaconda environment on windows 10 1) Download and install Anaconda 3.6 (3.5 and above) in your system from Anaconda site. 2) Restart your system 3) Create virtual environment by following command: conda create -n tensorflow

    4) Activate the virtual environment

    C:> activate tensorflow

    (tensorflow)C:> # Your prompt should change TensorFlow in anaconda 5) Following steps should start installing Tensorflow in virtual environment

    (tensorflow)C:> conda install -c conda-forge tensorflow 6) Now you may enter in python and work on tensorflow (tensorflow)C:> python

    7) But if you like to work on Tensorflow on Jupyter notebook you need to setup the karnel for your virtual environment in following steps: a) Install the ipython kernel module into your virtualenv

    activate your virtualenv, if you haven't already

    pip install ipykernel

    b) Now run the kernel "self-install" script: python -m ipykernel install --user --name=my-virtualenv-name

    Replacing the --name parameter as appropriate. In my case it is tensorflow

    c) You should now be able to see your kernel in the IPython notebook menu: Kernel -> Change kernel and be able so switch to it (you may need to refresh the page before it appears in the list). IPython will remember which kernel to use for that notebook from then on.

    8) Test the tensorflow with following program you should see “Hello, TensorFlow!”

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

提交回复
热议问题