Tensorflow installation detailed steps

Table of contents

Step 1: Install anaconda

1. Download any version of Python 2.7 or 3.3+

2. Edit 3. Edit

2. Environment configuration 

1. After the installation is completed, you need to check whether the computer has the anaconda environment configuration.

2. Add environment configuration

3. Build a virtual environment (GPU installation)

1. Open Anaconda Prompt

2. View the current virtual environment

3. Create a virtual environment for tensor

4. Activate the virtual environment that has been created

5. Install tensorflow

6. After the installation is complete, check whether tensorflow is available

7. Check whether tensorflow can be used

1). Enter the command in the current environment: python

2) Enter the command again: import tensorflow as tf

3) Then do a simple calculation and enter the command: print(tf.constant(1.)+tf.constant(2.))

4) Check if the calculation results are available and tensorflow is installed successfully.


Step 1: Install anaconda

Installation path: https://repo.anaconda.com/archive/

1. Download any version of Python 2.7 or 3.3+

2、3、

2. Environment configuration 

1. After the installation is completed, you need to check whether the computer has the anaconda environment configuration.

Find the settings and click System->System Information->Advanced System Settings->Environment Variables

Click on the path of user variables and system variables respectively to see if there is anaconda environment configuration.

User variables:

Environment variables:

If the check is not found, add it manually.

2. Add environment configuration

Double-click the path of the user variable and environment variable respectively, click New -> Browse, find the location of the anaconda file and add it, and finally click OK to complete the addition.

3. Build a virtual environment (GPU installation)

1. Open Anaconda Prompt

2. View the current virtual environment

Enter the command: conda env list

The computer has only one base by default

3. Create a virtual environment for tensor

Press win+R keys simultaneously on the keyboard, enter cmd first, a small black box will pop up, and then enter command: python --versionCheck the python version.

Install virtual environment:

Then enter y

NOTE: If

UnavailableInvalidChannel: The channel is not accessible or is invalid. Error, execute command: conda config -- remove-key channels to confirmy is used to restore the default source, then execute the third step of the command, and finally enter
re-enter Command: conda env list Check whether the virtual environment is installed successfully

4. Activate the virtual environment that has been created

ImportDirective: conda activate tensor 

 If the previous change from base to tensor is successful, the activation will be successful.

5. Install tensorflow

After activating tensor, switch to the path where you want to install the virtual environment, and enter the command: pip install tensorflow==2.9 -i https://pypi.tuna.tsinghua .edu.cn/simple/

My path here 

6. After the installation is complete, check whether tensorflow is available

ImportDirective: conda list

 

After entering, check whether there are these tensorflows. If so, the installation is complete.

7. Check whether tensorflow can be used

1), enter the command in the current environment: python

2), enter again command: import tensorflow as tf

3), then do a simple calculation and enter the command: print(tf.constant(1.)+tf.constant(2.))

4) Check if the calculation results are available and tensorflow is installed successfully.

 Installation completed, OK!

Guess you like

Origin blog.csdn.net/yh1009/article/details/132757439