Integrating Conda Environments into Visual Studio Code

Install Visual Studio Code

Download the official VS Code installer and proceed with default installation steps. After setup, install the Python extension from the marketplace.

Verify whether Conda is accessible from the system path:

Win + R → cmd → conda

If Conda returns version or help info, skip the next section. Otherwise, configure environment variables.

Configure Conda in System Path

Locate the Scripts directory inside the Anaconda installation folder (for example, C:\Anaconda3\Scripts). Copy its full path.

Open system environment settings:

  • Press Win + S, type Edit the system environment variables, and open it.
  • In the System Properties dialog, select Environment Variables.
  • Under System variables, find and select Path, then click Edit.
  • Add a new entry containing the copied Scripts path.

Select Conda Interpreter in VS Code

Trigger the quick command palette with Ctrl + P, enter > Python: Select Interpreter, and choose the desired Conda environment from the list.

Python Execution Setup

Ensure the Python installer includes the option Add Python to PATH. With this setting enabled, running .py files directly within VS Code will invoke the correct interpreter.

For C/C++ development:

  • Dwonload binaries from the official distribution site.
  • Extract the archive and append the bin directory path to the system Path variable.

Additional Configuration Options

  • Missing IntelliSense for Methods: Navigate to File > Preferences > Settings (or Ctrl + ,), search for @tag:usesOnlineServices or locate TypeScript: Disable Automatic Type Acquisition and enable it to restore method hints.

  • Python Code Formatting: Use Shift + Alt + F. Install an extension such as Black Formatter or autopep8 for consistent styling.

  • No Autocompletion: Restart the Pylance language server via the command palette (Ctrl + Shift + PPython: Restart Language Server).

  • Auto-Save Files: Open settings (Ctrl + ,), find Auto Save, and set it to onFocusChange.

  • Step Into Library Code During Debugging: In settings, disable Just My Code:

    • Open settings, search for justMyCode, and uncheck it.
  • Navigate Cursor to Previous Position: Assign shortcuts for Go Back and Go Forward navigation:

    • Ctrl + K then Ctrl + S opens keyboard shortcuts editor.
    • Search for Go Back and assign e.g., Alt + Left; for Go Forward, assign Alt + Right.
  • Expand Empty Folder Nodes: In settings, search for Compact Folders and uncheck the option to dispplay empty directories expanded.

  • Highlight Search Matches in Terminal: Modify settings.json:

    1. Open command palette (Ctrl + Shift + P) → Preferences: Open Settings (JSON).
    2. Add custom color rules under workbench.colorCustomizations:
{
  "workbench.colorCustomizations": {
    "terminal.findMatchHighlightBackground": "#fdf9c3",
    "terminal.findMatchBorder": "#e6b800",
    "terminal.findMatchHighlightBorder": "#ffcc00"
  }
}

Tags: VSCode conda python Environment Setup ide configuration

Posted on Wed, 03 Jun 2026 18:07:23 +0000 by lovely