Step 1: Enable and Update EPEL Repository
To download the required packages and dependencies, you’ll first need to install and update the EPEL repository. Use the following two commands:
sudo yum -y install epel-release

Step 2: Install Required Packages
Although TensorFlow supports multiple languages, Python is the one that provides the most features.
If you do not have Python installed on CentOS, run the following command to install pip (a package management system for Python) and the language itself:
sudo yum -y install gcc gcc-c++ atlas atlas-devel gcc-gfortran openssl-devel libffi-devel

After install Python in Centos8(How to install Python3.9.6 on Centos8_梦想家DBA的博客-CSDN博客) , check the command will be displayed as below :
yum -y install python-pip python-devel


Step 3: Create a Virtual Environment
Next, create an environment variable that points to the download URL for TensorFlow. Doing so isolates the package installation from the CentOS system.
Using the pip command, install and upgrade a virtual environment software. We recommend using Virtualenv, a tool specifically designed for creating isolated Python environments.
Use the following command to install and upgrade Virtualenv on CentOS:
pip3 install --upgrade virtualenv

Create a new environment by typing:
virtualenv --system-site-packages ~/venvs/tensorflow

Finally, activate the environment:
source ~/venvs/tensorflow/bin/activate

Activating the environment changes the command line prompt, adding the virtual environment’s bin directory as a prefix. This means you are now working inside the virtual environment.
Step 4: Install TensorFlow
After setting up and activating the virtual environment, you can finally move on to installing the TensorFlow library. There are two available software packages, TensorFlow for CPU and TensorFlow for GPU.
Install TensorFlow for CPU
The default software package supports CPU-powered machine-learning workloads. To install the latest stable release of TensorFlow for CPU (recommended for beginners) and dependencies, type:
pip install --upgrade tensorflow
nstall TensorFlow for GPU
TensorFlow for GPU supports GPU-powered machine-learning workloads. To install the latest stable release of TensorFlow for GPU (recommended for beginners), execute the following command:
pip install --upgrade tensorflow-gpu
Step 5: Verify TensorFlow Installation
Verify TensorFlow installation with the following command:
python -c "import tensorflow as tf;print(tf.reduce_sum(tf.random.normal([1000, 1000])))"
3883

被折叠的 条评论
为什么被折叠?



