Anaconda3 under Mac can switch Python version at will, and install tensorflow (CPU) for different versions of Python at the same time

Time:2022-5-10

First download the corresponding version of Anaconda on the official website of anaconda

Installing anaconda3

Open anaconda3, click environments on the left side of the interface, and then click the Create button below. The following window will appearAnaconda3 under Mac can switch Python version at will, and install tensorflow (CPU) for different versions of Python at the same time

Name the python environment to be created and select the version. After selecting it, click create to generate a new Python version environment, as shown in the following figure
Anaconda3 under Mac can switch Python version at will, and install tensorflow (CPU) for different versions of Python at the same time

Use different versions of Python under anaconda3:

1. Use in anaconda3 graphical interface: just click the corresponding environment name, if necessary, in Python 2 7. Click py27 to switch to Python 2 seven

2. Use on MAC terminals: 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 are for Python 2 7 version; To return to the default version (the default version is 3.6), enter

source deactivate

(Note: under Windows system, the environment switching and closing are similar to the above, but one less source command is added)

Install tensorflow in different versions of Python under anaconda3:

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

pip install tensorflow

perhaps

conda install tensorflow

Tensorflow can be installed