Anaconda3 on MAC switches Python version at will, and installs tensorflow (CPU) for different Python versions

Time:2019-12-9

First, download the corresponding version of anaconda3 on the official website of Anaconda

Install anaconda3

Open anaconda3, click environments on the left side of the interface, and then click create to open the following windowAnaconda3 on MAC switches Python version at will, and installs tensorflow (CPU) for different Python versions

Name the python environment to be created and select the version. Click create to generate a new Python version environment, as shown in the following figure
Anaconda3 on MAC switches Python version at will, and installs tensorflow (CPU) for different Python versions

Use different versions of Python under anaconda3:

1. Use in anaconda3 graphical interface: just click the corresponding environment name. If you need to use it in Python 2.7, click py27 to switch to Python 2.7

2. Use in MAC terminal: terminal input

Source activate {environment name}

as

source activate py27

You can switch the version to Python 2.7. At this time, the PIP and CONDA commands under the terminal operate on Python 2.7. If you want to return to the default version (the default version is 3.6), enter

source deactivate

(Note: under Windows system, the environment switching and shutting down are similar to the above, only one source command is added less.)

Install tensorflow in different versions of Python under anaconda3:

Because the Mac only supports the CPU version of tensorflow, the installation is also relatively simple. Switch to the python version you want to use, and input

pip install tensorflow

perhaps

conda install tensorflow

To install tensorflow