DEV Community

Cover image for Add Anaconda Prompt to Windows Terminal - Solution for Space in Executable Path Issue
Vivek Puurkayastha
Vivek Puurkayastha

Posted on

Add Anaconda Prompt to Windows Terminal - Solution for Space in Executable Path Issue

Windows Terminal is one of the very few things likable about Windows when it comes to developers. It is customize-able and fun.

By default Anaconda Prompt is not one of the available terminal profiles in Windows Terminal. So if you have installed Python through Anaconda, it can be very tedious to switch between terminal applications to issue Python commands. However it is completely possible to set up Anaconda prompt as part of the Windows Terminal, which allows to open Anaconda Terminal as new tab in the Terminal application.

This article assumes that Windows terminal and Anaconda are already installed.

Add Anaconda prompt to Windows Terminal

  1. Open Windows Terminal
  2. Press Ctrl+,. This will open Settings Tab.
  3. Open JSON file.
    Settings Tab

  4. Copy the cmd setting (look for "name" : "Command Prompt") and paste it just above (or where you want) the existing code block.
    Command Prompt JSON Settings

  5. Next change the following in the copied block. Remember it is in the key: value format:

    • guid : Change it anything unique. Ex: change the last 5 letters/digits
    • name: Name it to Ananconda Prompt
    • commandline: This is the path that should point to the Anaconda bat file. Generally this is located at following location: "C:\\Users\\XXXX\\anaconda3\\Scripts\\activate.bat\". Replace XXXX with your User Name.
    • In case you cannot find the Anconda .bat file in the above specified location; search for Anaconda in Windows Search Bar.
    • Right click and Open File location
    • On the Anaconda Prompt shortcut, right click and select properties.
    • Next copy the .bat part of the path specified in the Target dialogue box.
    • Next replace the value of commandline: "cmd.exe /K C:\Users\XXXX\anaconda3\Scripts\activate.bat\" Anaconda JSON Settings
  6. Save the Settings.JSON.

  7. Go to the Windows Terminal and point to the down arrow there should now be an option for "Anaconda Prompt".
    Anaconda Prompt option

  8. Problematic Part: In case you have a space in the anaconda activate.bat, then you will get Syntax error thrown after saving the Settings.JSON file. Generally this happens when people have spaces in their user name. In that case modify the commandline value as "cmd.exe /K \"C:\Users\User Name with Space\anaconda3\Scripts\activate.bat \""

celebration GIF

Discussion (0)