Anaconda3 installation and multi-version python configuration

Overview

Anaconda is an independent package management system that integrates package management, virtual environment, python and common extension packages.
conda is a command line tool provided in anaconda, similar to pip
Anaconda's environment management can provide independent environments for different versions of python.

Anaconda3 download

https://www.anaconda.com/distribution/

Precautions in Anaconda3 installation,
  • Install for option.
    • Just me is installed under the user account
    • All users can use all user accounts on the computer
  • Advanced options
    • Whether to add anaconda to the system environment variables
    • Default python version
  • Verify installation
    • win10, start Anaconda Prompt
    • enter:conda -V
    • Return the Anaconda version number, that is, the installation is successful.

The current python version of anaconda3 is 3.7

Install python2.7 version
  • Open Anaconda3 Powershell Prompt
  • Enter conda create -n python27 python=2.7. Create an environment named python27 and install the latest version of python2.7.
  • conda info -eCheck the installed environment. There should be only base and python27 at this time.
  • conda activate python27 Switch to python27 environment
  • python --versionCheck the current python version. "Python 2.7.16" is displayed
  • Return to the base environment,conda activate
Configure Anaconda in VSCode
  • Open Visual Studio Code

  • ctrl+, Shortcut key to open setting,

    • Enter in the search bar python.condapathand fill in the Anaconda3 installation path. For example: "D:\anaconda3"
    • Enter the search bar python.venvpathand fill in the envs directory under Anaconda3. For example: "D:\anaconda3\envs"
  • Restart vscode, at this time, select the interpreter column should be able to display python3.7 and python2.7.

Guess you like

Origin blog.csdn.net/rentonhe/article/details/99718084