Reprinted from https://blog.csdn.net/u010801439/article/details/79485914
First of all, what everyone needs to understand is that under the original ubuntu system, there is a python environment. However, in order to have different needs in different periods, sometimes, python2 is required, but in some cases, it is necessary to use python3, then, how can I switch freely under the ubuntu system, and quickly use the two versions of python2 and python3~ Next, I will introduce the usage method in detail.
First, prepare the documents:
在ubuntu 系统下安装好anaconda3(2)任意一个版本
Second, make sure conda or pip are up to date (or just update them)
更新pip: pip install updata pip
更新conda: conda update conda
Third, install multiple versions, switch (exit) multiple versions
Create an environment named py3 based on python3.6:
conda create --name py3 python=3.6
Then create an environment named py2 based on python2.7:
conda create --name py2 python=2.7
Activate the relevant environment (eg: py2):
激活py2: source activate py2
注销py2: source deactivate py2