Post 2023-09

Tensorflow Installation for Machine Learning


Here, we present how to install tensorflow for machine learning:
  1. How to install Anaconda
  2. How to install python 3.7 and tensorflow 2.4
  3. How to install python 3.10 and tensorflow 2.9
  4. Tips of solving problems of Tensorflow
Blog Image

1. How to install Anaconda:
  • Download Anaconda with the appropriate version
  • Install it for all users
  • Select "Add Anaconda to the system path environment variable" and "Register Anaconda ..."

Note that We need to download Anaconda and Pycharm. Avaliable: Anaconda and Pycharm


2. How to install python 3.7 and tensorflow 2.4 for Windows OS
(1) Install python environment by using the command window of Anaconda:
  • $ conda -V
  • $ conda info --envs
  • $ conda create --name tensorflow python=3.7
(2) Use the following commands to install tensorflow 2.4 for "tensorflow" under "envs" folder:
  • $ conda activate tensorflow
  • $ pip install tensorflow-cpu==2.4

3. How to install python 3.10 and tensorflow 2.9 for Windows OS
(1) Install python environment by using the command window of Anaconda:
  • $ conda -V
  • $ conda info --envs
  • $ conda create --name tensorflow310 python=3.10
(2) Use commands below to install tensorflow 2.9 for "tensorflow310" under "envs" folder:
  • $ conda activate tensorflow310
  • $ pip install tensorflow-cpu==2.9

4. How to install python and tensorflow for MAC OS

For MAC with M series chips, they cannot decode the X86 commands of tensorflow directly becasue of the ARM platform. Alternatively, miniforge3 or Miniconda for ARM platform can be utlized to run tensorflow.

Install Anaconda environment by using the Miniconda:

Download miniconda from hhttps://docs.anaconda.com/free/miniconda/miniconda-other-installer-links for Mac M1/M2. Miniconda usually installed under the "opt" folder. To access the "opt" folder, please use the key combination: "Shift + Command + G".

  • $ conda -V
  • $ conda info --envs
  • $ conda create -n tensorflow python=3.10
Use commands below to install tensorflow 2.12 for "tensorflow310" under "envs" folder:
  • $ conda activate tensorflow
  • $ conda install tensorflow

For miniforge installation, please refer to https://zhuanlan.zhihu.com/p/445535362 for the details.


5. Tips of Using Tensorflow
(1) NameError: name 'glPushMatrix' is not defined
  • $ pip install pyglet==1.5.27
(2) TensorFlow Probability
  • $ pip install tensorflow_probability==0.17.0

tensorflow_probability 0.12.1 and 0.12.2 are used for tensorflow 2.4.0.
tensorflow_probability 0.17.0 is designed for tensorflow 2.9.1.
For more details: please check TensorFlow Probability Releases.

(3) A piece of information about packages of my tensorflow codes:
scipy 1.7.3 dill 0.3.7
pandas 1.3.5 matplotlib 3.5.3

Thanks for visiting my website, please refer to https://eulz.net for more information.
Updated on April 2, 2024.

Leave a Comments

Send us your valuable feedback about our services