Step 1: Create a virtual environment to do the job
python3 -m venv ./
Create the virtual environment in my target directory. For Python 3, the venv module comes with the standard library installed. The following directory is created with the above command.
![](http://52.79.193.147/wp-content/uploads/2020/06/image-3.png)
In order to use this environment’s packages/resources in isolation, we will need to “activate” it. To do this, just run the following:
source ./bin/activate
I have create my vent in the directory tfavxfma, after activating the venv, what I see is as below:
wt@Ws-Mac-mini tfavxfma % source ./bin/activate
(tfavxfma) wt@Ws-Mac-mini tfavxfma %
Step 2: Download tensorflow and prepare the dependencies
Download tensorflow from GitHub:
git clone https://github.com/tensorflow/tensorflow
![](http://52.79.193.147/wp-content/uploads/2020/06/image-4.png)
Next navigate into the newly cloned tensorflow code directory and execute execute the checkout command to navigate to the latest branch.
git checkout r2.0
![](http://52.79.193.147/wp-content/uploads/2020/06/image-5.png)
The latest branch of tensorflow is found here.
![](http://52.79.193.147/wp-content/uploads/2020/06/image-6-1024x608.png)
Next install tensorflow dependencies:
pip3 install -U pip six numpy wheel setuptools mock future
pip3 install -U keras_applications –no-deps
pip3 install -U keras_preprocessing –no-deps
![](http://52.79.193.147/wp-content/uploads/2020/06/image-8.png)
Step 3: Download the tensorflow compiling tools
Well, install Xcode and Bazel ( the tool to compile tensorflow)
Next run
./configure
Accept the default configurations and specify the python3 to use in the venv setup previously. Once done, execute the following:
bazel build -c opt –copt=-mavx –copt=-mavx2 –copt=-mfma –copt=-msse4.2 //tensorflow/tools/pip_package:build_pip_package