Preface
Anaconda is a scientific computing release of Python that contains more than 300 popular Python Packages for science, math, engineering, and data analysis. Since Python has 2 and 32 versions, Anaconda has also launched two distributions, Anaconda2 and Anaconda3, based on Python2 and Python3.
Sometimes we use the two versions of Anaconda2 and Anaconda3 on our computers, so it is necessary to consider their coexistence issues. The general use of the scene is one of the main version, the other version as a supplement, so only to achieve a convenient switch to the standby version, and the alternate version of the PIP and other commands can be used normally.
Because Anaconda2 and Anaconda3 contain more modules, many people do not need these, so if only want more pure Python2 and Python3 coexistence, you can see the last part of this article. Operation Steps
First install the main version, where we choose Anaconda2, follow the normal steps to install, where the installation directory is assumed to be D:\Anaconda2.
Make those two hooks in this step.
The first option is to add the installation directory to the system's path environment variable, and later in CMD, you can start Python directly with the python command.
The second option is to have the other IDE detect ANACONDA2 and Anaconda2 as the default Python 2.7.
Install the Anaconda2, then install ANACONDA3, here Anaconda3 installation directory must be selected in D:\Anaconda2\envs subdirectory, as shown in the picture, the last "Py3" can be taken by themselves.
Here is the cancellation of the two hooks (in the literal sense, the second tick should have no effect.) As for the first option, because the ANACONDA2 has been added to the system path before, so add the Anaconda3, because the order in the Anaconda2 behind, almost no effect, so there is no hook here.
After the installation is complete, the direct input python inside cmd will start Python2, and then use python to switch to Python3 after using activate Py3 (Py3 the name of the directory folder before Python3), as shown in the following figure. After using the Activate Py3 command, a [PY3] tag appears in front of the command line, and any Python commands are used under Python3. Use the Deactivate command to cancel activation of the Python3.
Pure python Coexistence
Said to be pure, is not completely "pure", here needs to use another distribution Miniconda, it contains only python itself and Conda Package Manager, so small. The coexistence installation method when using Miniconda is exactly the same as the above steps.
Miniconda Download Homepage Summary
The coexistence of this article is based on the Conda of the creation of virtual environment features, the details can be seen in this link.
Therefore, you can also use the Conda create-n py3 python=3 command to install Python3 after you first install the major version, but this method is easy to fail due to network problems, so it is easier to download the full installation package and then install the Envs folder in the main version home directory.
One might say that installing Anaconda2 and Anaconda3 directly at the same time, and then changing Python.exe in the Anaconda3 directory to Python3.exe can also achieve similar coexistence. But there is a big flaw in this approach, that some of the Ides contained within the ANACONDA3 will not work properly, such as Jupyter notebook and Spyder, Because they rely on the Python.exe in the installation directory, and the alternate version of the PIP and other commands can not be used directly, the overall inconvenience.
Reprint Address: http://blog.csdn.net/infin1te/article/details/50445217