TensorFlow : Install2020/07/23 |
Install TensorFlow which is the Machine Learning Library.
On this example, Install TensorFlow 2.0.
|
|
[1] | |
[2] | Install other required packages. |
[root@dlp ~]# dnf -y install python36-devel python3-virtualenv gcc gcc-c++ make
|
[3] | Login as a common user and prepare Python virtual environment to install TensorFlow. If you'd like to install it on System Wide, skip this section and execute the next [4] with root user account. |
[cent@dlp ~]$ virtualenv --system-site-packages -p python3 ./venv Running virtualenv with interpreter /usr/bin/python3 Using base prefix '/usr' New python executable in /home/cent/venv/bin/python3 Also creating executable in /home/cent/venv/bin/python Installing setuptools, pip, wheel...done.[cent@dlp ~]$ source ./venv/bin/activate (venv) [cent@dlp ~]$ |
[4] | Install TensorFlow 2.0. |
(venv) [cent@dlp ~]$
pip3 install --upgrade tensorflow==2.0.0b1
# confirm numpy version (venv) [cent@dlp ~]$ pip3 show numpy
Name: numpy Version: 1.19.1 Summary: NumPy is the fundamental package for array computing with Python. Home-page: https://www.numpy.org Author: Travis E. Oliphant et al. Author-email: None License: BSD Location: /home/cent/venv/lib/python3.6/site-packages Requires: Required-by: tensorflow, tb-nightly, Keras-Preprocessing, Keras-Applications, h5py # on TensorFlow 2.0 + numpy 1.17 or later, # many Warnings are displayed, so downgrade to 1.16 (venv) [cent@dlp ~]$ pip3 install --upgrade numpy==1.16.0 (venv) [cent@dlp ~]$ pip3 show numpy Name: numpy Version: 1.16.0 Summary: NumPy is the fundamental package for array computing with Python. Home-page: https://www.numpy.org Author: Travis E. Oliphant et al. Author-email: None License: BSD Location: /home/cent/venv/lib/python3.6/site-packages Requires: Required-by: tensorflow, tb-nightly, Keras-Preprocessing, Keras-Applications, h5py # verify to run TensorFlow (venv) [cent@dlp ~]$ python3 -c "import tensorflow as tf;print(tf.reduce_sum(tf.random.normal([1000, 1000])))" 2020-07-22 21:16:17.047533: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 2801355000 Hz 2020-07-22 21:16:17.048084: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x5633e28df970 executing computations on platform Host. Devices: 2020-07-22 21:16:17.048148: I tensorflow/compiler/xla/service/service.cc:175] StreamExecutor device (0): <undefined>, <undefined> tf.Tensor(545.2815, shape=(), dtype=float32) # Hello World on TensorFlow (venv) [cent@dlp ~]$ python3 -c "import tensorflow as tf; hello = tf.constant('Hello, TensorFlow World'); tf.print(hello)" 2020-07-22 21:17:51.815296: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 2801355000 Hz 2020-07-22 21:17:51.815812: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x5633f4d64910 executing computations on platform Host. Devices: 2020-07-22 21:17:51.815899: I tensorflow/compiler/xla/service/service.cc:175] StreamExecutor device (0): <undefined>, <undefined> Hello, TensorFlow World |
Sponsored Link |
|