Today I am going to introduce how to install TensorFlow/Pytorch via Anaconda in macOS. Before I used Anaconda, I always used virtualenv to build independent environment for different projects. But I still need to select specific versions of each Python packages and install them by myself, which is quite time consuming. When I happened to use Anaconda, I believe that Anaconda is the best way to install TensorFlow and other deep learning frameworks in macOS.
Install Xcode Command Line Tools
First, you need to sign in the Apple Developer website to install Xcode Command Line Tools. I do not suggest installing Xcode IDE, because it is too large.
For me, I have installed Xcode IDE before and built many virtualenv projects. I just made a backup of my data in my Mac, erased my Mac disk and reinstalled macOS system. Actually reinstalling macOS system only costs 30-40 minutes and it is a simplest way to restart.
Install Anaconda & VS Code
Next, you need to download and install Anaconda IDE and you can choose Python 3.7 version or Python 2.7 version.
During installing Anaconda, I suggest that you install Visual Studio Code at the same time. Because Visual Studio Code is a lightweight code editor and it almost supports all popular programming languages. It is quite convenient to build independent environment using Anaconda and debug code via VS Code.
Install TensorFlow and Other Framework
When you finish installing Anaconda, you can create independent environment for each project and install different packages.
First, you need to create a new environment and choose Python version. Then you can search TensorFlow package in the search box and install it. When the TensorFlow is installed, the other corresponding packages will be also installed. If you cannot find some packages via the search box. You can open terminal to install them instead.