1. Open Terminal or Anaconda Prompt (Windows users).
2. Enter the following command to create a new Python environment:
conda create --name <env_name> python=<version>
Among them, <env_name>
is the name of the environment you want to create, <version>
and is the Python version number you want to install. For example, to create python37
a Python 3.7 environment named, enter the following command:
conda create --name python37 python=3.7
3. Enter the environment you want to use and use pip to install the application.
conda activate python37
After entering, the following screen will be displayed
Use the following commands to install tensorflow-gpu and tf_agents one after another. Be sure to enter the full version number.
pip install tensorflow-gpu==2.10.0
pip install tf_agents==0.14.0
After the installation is complete, enter python round to enter the python programming interface and check the installation version number.
If both versions are normal and no errors are reported, the installation is considered successful. However, if an error is reported and it is a numpy error, you need to reinstall numpy.
#如报错则重新执行以下代码,否则不需要执行
pip uninstall numpy
pip install numpy==1.23.5
4. Check if there is an available GPU
tf.config.list_physical_devices('GPU')
If there is a GPU, it will be displayed as shown below
Related additional conda commands:
Exit the current conda environment: conda deactivate
View the currently installed environment: conda env list
Remove the environment: conda remove --name python37 --all
If you want to completely delete the previous installation environment and temporary files, you need to enter the corresponding directory and delete the folder:
For example, manually delete the python37 folder