######## for Python 2.7 pip install --upgrade pip pip install --upgrade tensorflow ######## for Python 3.n pip3 install --upgrade pip pip3 install --upgrade tensorflow
Here is what the above code is Doing:
1. It installs the pip package manager for Python.
2. It upgrades pip to the latest version.
3. It installs the TensorFlow package.
4. It upgrades TensorFlow to the latest version.
If you’re using Python 3, you’ll need to replace pip with pip3 in the commands above.
You can also install TensorFlow using Anaconda.
To install TensorFlow using Anaconda, follow these steps:
1. Download and install Anaconda.
2. Open the Anaconda Prompt.
3. Type the following command and press Enter:
conda create -n tensorflow pip python=3.5
4. This creates a new Anaconda environment that is dedicated to TensorFlow.
5. Type y and press Enter to confirm the creation of the environment.
6. Activate the new environment by typing the following command and pressing Enter:
7. Install TensorFlow in the environment by typing the following command and pressing Enter:
pip install –ignore-installed –upgrade tensorflow
8. Close the Anaconda Prompt and open the Anaconda Navigator.
9. Click the Environments tab.
10. You should see the new tensorflow environment that you created.
11. Select the environment and click the play button to open a Jupyter Notebook.
12. In the notebook, select File > New > Python 3 to create a new Python file.
13. Type the following code in the file and press Shift+Enter to run it:
import tensorflow as tf
14. If you see the name of a GPU, then TensorFlow is using the GPU.
15. If you don’t see the name of a GPU, then TensorFlow isn’t using the GPU.
16. Close the notebook.
17. Deactivate the environment by typing the following command and pressing Enter:
18. Close the Anaconda Navigator.
You can now use the environment to run TensorFlow code.
To use the environment, follow these steps:
1. Open the Anaconda Prompt.
2. Activate the environment by