How to install TensorFlow on CentOS 8

TensorFlow is an open source platform for machine learning developed by Google. It can run on the CPU or GPU of different devices, and it is used by many organizations, including Twitter, PayPal, Intel, Lenovo, and Airbus.

TensorFlow can be installed as a system-wide installation, in a Python virtual environment, as a Docker container, or installed with Anaconda.

This article explains how to install TensorFlow on CentOS 8.

TensorFlow supports both Python 2 and 3. We will use Python 3 and install TensorFlow in a virtual environment. A virtual environment allows you to have multiple different and isolated Python environments on a computer, and rush each project to install the specified version of the module without worrying about it affecting other projects.

1. Install TensorFlow on CentOS

Unlike other Linux distributions, Python is not installed on the default CentOS 8. To install Python3 on CentOS 8, run the following command as root or sudo user in the terminal:

sudo dnf install python3

The above command will install Python 3.6 and pip. To run Python 3, you need to enter python3 and pip3 to run pip.

Starting from Python 3.6, the recommended way to create a virtual environment is to use the venv module.

Switch to a directory, which is where you store your TensorFlow project. It can be your home directory or any other directory where the user has read and write permissions.

Create a new directory for the TensorFlow project and switch to the directory:

mkdir tensorflow_project 
cd tensorflow_project

In this directory, run the following command to create a virtual environment:

python3 -m venv venv

The above command creates a directory named venv, which contains Python binary files, pip standard Python library, and other supporting files. You can name the folder with any name you want.

To start using a virtual environment, enter the following command to activate it:

source venv/bin/activate

Once activated, the bin directory of the virtual environment will be added to the front of the $PATH environment debate. Of course, your shell prompt will change and it will display the name of the virtual environment you are using. In this example, venv is displayed.

TensorFlow installation requires pip version 19 or higher. Run the following command to upgrade pip to the latest version:

pip install --upgrade pip

Now that the virtual environment has been created and activated, use the following command to install the TensorFlow library:

pip install --upgrade tensorflow

If you have a separate NVIDIA GPU and you need to use its processing power, do not use the tensorflow package, but install the tensorflow-gpu package, which includes GPU support.
In this virtual environment, you can use the command pip to replace pip3, and python to replace python3

To verify the installation, run the following command, which will print the version number of TensorFlow:

python -c 'import tensorflow as tf; print(tf.__version__)'

As of this writing, the latest stable version of TensorFlow is 2.1.0:

2.1.0

Your TensorFlow version may be different from the one shown.

If you are a TensorFlow novice, browse the Get Started with TensorFlow page and learn how to build your first ML application. You can also clone TensorFlow Models or TensorFlow-Examples from Github and browse and test TensorFlow examples.

Once you have finished your work, deactivate the environment, type deactivate, and you will return to the normal shell.

deactivate

that's it! You have successfully installed TensorFlow and you can start using it.

Three, summary##

We have shown you how to install TensorFlow in a virtual environment on CentOS 8.

Recommended Posts

How to install TensorFlow on CentOS 8
How to install jdk1.8 on centOS7
How to install MySQL on CentOS 8
How to install Memcached on CentOS 8
How to install R on CentOS 8
How to install FFmpeg on CentOS 8
How to install Virtualbox on CentOS 8
How to install TeamViewer on CentOS 8
How to install Perl 5 on CentOS
How to install Git on CentOS 8
How to install Gradle on CentOS 8
How to install Elasticsearch on CentOS 8
How to install Jenkins on CentOS 8
How to install Java on CentOS 8
How to install Go on CentOS 8
How to install GCC on CentOS 8
How to install Yarn on CentOS 8
How to install Nginx on CentOS 8
How to install Asterisk on CentOS 7
How to install Jenkins on CentOS 8
How to install Vagrant on CentOS 8
How to install Python 3.8 on CentOS 8
How to install Tomcat 9 on CentOS 8
How to install Webmin on CentOS 8
How to install Ruby on CentOS 8
How to install Skype on CentOS 8
How to install htop on CentOS 8
How to install Python on CentOS 8
How to install Elasticsearch on CentOS 8
How to install Postgresql on CentOS 8
How to install Wordpress on Centos
How to install htop on CentOS 8
How to install TeamViewer on CentOS 8
How to install MariaDB on CentOS 8
How to install MongoDB on CentOS 7
How to install Odoo 13 on CentOS 8
How to install Apache on CentOS 8
How to install OpenCV on CentOS 8
How to install PHP on CentOS 8
How to install MongoDB on CentOS 8
How to install Apache Maven on CentOS 8
How to install Apache Kafka on CentOS 7
[Graphic] How to install tomcat on centos
R&D: How To Install Python 3 on CentOS 7
How to install GCC compiler on CentOS 7
How to install offline JDK1.8 on centos7.0
How to install and configure Elasticsearch on CentOS 7
How to install and use Docker on CentOS 7
How to install RPM packages on CentOS Linux
How to install and configure VNC on CentOS 8
How to install and use Composer on CentOS 8
How to install and configure Redis on CentOS 8
How to install Node.js and npm on CentOS 8
How to install jdk1.8.0_151 and mysql5.6.38 on centos7.2.1511
How to install and configure phpMyAdmin on CentOS 6
How to install and use Curl on CentOS 8
How to install and configure Owncloud on CentOS 8
How to install VirtualBox client extension on CentOS 8
How to install Docker CE on RHEL 8 / CentOS 8
How to install and uninstall tomcat on centos
How to install and configure Redmine on CentOS 8