Python 环境管理工具 Conda - Python 2 和 Python 3 环境切换1. Switching between Python 2 and Python 3 environments (在 Python 2 和 Python 3 环境之间切换)ReferencesCondahttps://conda.io/en/latest/https://docs.conda.io/projects/conda/en/latest/index.htmlCommand referencehttps://conda.io/projects/conda/en/latest/commands.htmlAnaconda Documentationhttps://docs.anaconda.com/Conda 是一个开源的软件包管理系统和环境管理系统用于安装多个版本的软件包及其依赖关系并在它们之间轻松切换。Package, dependency and environment management for any language - Python, R, Ruby, Lua, Scala, Java, JavaScript, C/ C, FORTRAN, and more.Conda 是为 Python 程序创建的适用于 Windows, macOS, Linux and z/OS也可以打包和分发其他软件。Conda is an open source package management system and environment management system that runs on Windows, macOS, Linux and z/OS. Conda quickly installs, runs and updates packages and their dependencies. Conda easily creates, saves, loads and switches between environments on your local computer. It was created for Python programs, but it can package and distribute software for any language.Conda as a package manager helps you find and install packages. If you need a package that requires a different version of Python, you do not need to switch to a different environment manager, because conda is also an environment manager. With just a few commands, you can set up a totally separate environment to run that different version of Python, while continuing to run your usual version of Python in your normal environment.Conda 作为软件包管理器可以帮助您查找和安装软件包。如果您需要一个需要使用其他版本的 Python 的软件包则无需切换到其他环境管理器因为 conda 也是环境管理器。仅需几个命令您就可以设置一个完全独立的环境来运行该不同版本的 Python同时继续在正常环境中运行您通常的 Python 版本。The conda package and environment manager is included in all versions of Anaconda and Miniconda.所有版本的 Anaconda 和 Miniconda 中都包含 conda 软件包和环境管理器。1. Switching between Python 2 and Python 3 environments (在 Python 2 和 Python 3 环境之间切换)You can easily maintain separate environments for Python 2 programs and Python 3 programs on the same computer, without worrying about the programs interacting with each other.Switching to an environment is called activating it.您可以轻松地在同一台计算机上为 Python 2 程序和 Python 3 程序维护单独的环境而不必担心程序相互交互。Create a Python 2 environment named py27, install Python 2.7:conda create --name py27 python2.7Create a new environment named py35, install Python 3.5:conda create --name py35 python3.5Now you have two environments with which to work. You can install packages and run programs as desired in either one.Activate and use the Python 2 environment.Windows:activate py27macOS, Linux:conda activate py27Deactivate the Python 2 environment. Use your py27 environment to install packages and run programs as desired. When finished, deactivate the environment.Windows:deactivatemacOS, Linux:conda deactivateActivate and use the Python 3 environment.Windows:activate py35macOS, Linux:conda activate py35Use the py35 environment to install and run programs as desired. When finished, deactivate the environmentDeactivate the Python 3 environment.Windows:deactivatemacOS, Linux:conda deactivateReferences[1] Yongqiang Cheng (程永强), https://yongqiang.blog.csdn.net/[2] Python 环境管理工具 Conda - Python 2 和 Python 3 环境切换, https://mp.weixin.qq.com/s/z5Km2pA9iHEVQyx_SQ8kFw