TensorFlow is an open source machine learning platform built by Google. TensorFlow is used by a number of organizations including Twitter, PayPal, Intel, Lenovo, and Airbus.
TensorFlow can be installed system-wide, in a Python virtual environment, as a Docker container or with Anaconda.
TensorFlow supports Python 2 and 3. We will be using Python 3 and installing TensorFlow inside Virtual environment.
Virtual environment It allows you to have many different Python isolated environments on one computer and install a specific version of Unity based on each project, without worrying that it will affect your other projects.
Install TensorFlow on CentOS
Unlike other Linux distributions, Python is not installed by default on CentOS 8. To install Python 3 on CentOS 8, run the following command as the root user or
sudo At your stop:
sudo dnf install python3
The above command will install Python 3.6 and pip. To run Python 3, you must type
python3 Frankly, the point type run
Starting with Python 3.6, the recommended way to build Virtual environment It is the use of units
Enter the directory where you want to save the TensorFlow project. This can be in your home directory or another directory where you can access read and write.
Create a new directory for TensorFlow project and enter it:
Inside the directory, run the following command to create Virtual environment :
python3 -m venv venv
The above command creates a directory named
venv, Contains a copy of the Python binary, the Python pip library, and other supporting files. You can use any name you want Virtual environment.
To start using Virtual environment, Activate it by typing:
Once activated, the manual
bin in a Virtual environment Will be added at the beginning of the variable
$PATH. Additionally, your Command Prompt will change, and it will display a name Virtual environment You are currently using. In this case it is
Tensorflow and Pip
Requires TensorFlow installation
pip Version 19 or higher. Run the following command to upgrade
pip To the latest version:
pip install --upgrade pip
distance Virtual environment Created and activated, install TensorFlow library with the following command:
pip install --upgrade tensorflow
If you have an NVIDIA GPU and want to take advantage of the power of this GPU for processing, install the package
tensorflow-gpu, Which includes and extends tensorflow functionality to support GPU.
in a Virtual environment, You can use pip instead of pip3 and python instead of python3.
To verify the installation, run the following command, which will print out the version of TensorFlow:
python -c 'import tensorflow as tf; print(tf.__version__)'
At the time of writing this article, the most recent stable version of TensorFlow is
Your version of TensorFlow may differ from the one shown here.
If you are new to TensorFlow, visit the Getting Started with TensorFlow page and learn how to create your first machine learning app. You can also clone TensorFlow models or TensorFlow examples repository from Github and explore and test TensorFlow examples.
When you are done with your work, disable the environment by typing
deactivate, And you’ll be back to your normal shell.
At this point, you have successfully installed TensorFlow, and you can start using it.
We showed you how to install TensorFlow inside Virtual environment On CentOS 8.