Windows Python Developers Had Better Setup Earlier (II): Add Anaconda Prompt on Windows Terminal

Combing Anaconda Prompt and Windows Terminal make your work more efficient

In the previous article, it shows how to install Windows Terminal, Set up the Windows Terminal, and also introduce to 6 basic but regularly used features of the Windows Terminal.

This is the second part of the post series, which talk about how to add Anaconda Prompt on the Windows Terminal. The rest of the post series as follows. If you are interested in this series, please follow me.

For Python developers, especially data analysis and machine learning scientists, Anaconda Python distribution is the world’s most popular Python distribution platform with over 20 million users worldwide. It is advantageous because it includes Python and 720+ most popular libraries and tools, and it is the most widely used Python distribution for data science. Windows Terminal makes Windows owns a real terminal like Linux and macOS. However, Anaconda Prompt and Anaconda PowerShell Prompt is not integrated on the Windows Terminal.

1. Why We Should Add Anaconda Prompt on Windows Terminal

It would be very handy if we can add Anaconda Prompt or Anaconda PowerShell on Windows Terminal. In this article, we just talk about Anaconda Prompt. Here let’s see a simple example, accessing into the path, which is regularly used by Python developer. Let’s say, access the working directory  “D:\mylecture\wavelet_analysis’ on my computer, and then start Jupyter notebook. We need to open the Anaconda Prompt and then type and run the following command line by line.

$ D:
$ cd mylecture\wavelet_analysis
$ jupyter notebook

Fig.1. Access Working Directory on Anaconda Prompt

After adding Anaconda Prompt on Windows Terminal, we just need to open the folder of wavelet_analysis, and then right-click “Open in Windows Terminal”.

 

Fig.2. Access Working Directory by Opening in Windows Terminal

The Windows Terminal tab opens, it shows that we are already in the folder.

 

Fig.3. Open the Working Directory from Windows Terminal

We just click the dropdown arrow on Windows Terminal and then click “Anaconda Prompt” to start Anaconda Prompt/

 

Fig.4. Starting Anaconda Prompt from Windows terminal

Then we just type jupyter notebook to start Jupyter notebook.

 

Fig.5. start Jupyter notebook from Anaconda prompt on Windows Terminal

2. Copy the Target of Anaconda Prompt

Now let’s see how to Add Anaconda Prompt on Windows Terminal.

(1) Search the target of Anaconda Prompt

  • Type Anaconda Prompt on the search box of Windows 10 or 11
  • Right click to open the location
  • Right click Anaconda Prompt
  • Hit Properties
  • Copy the path in Target

 

Fig.6. Search the path of Anaconda Prompt

(2) Edit the target

Open any text file editor, such as MS Word, text, and whatever, and past what you just copied into it. It is something looks like follows, but where my PC user name is Sigmund which is different from yours:

%windir%\System32\cmd.exe "/K" C:\Users\Sigmund\anaconda3\Scripts\activate.bat C:\Users\Sigmund\anaconda3

Edit it and just keep the following information:

cmd.exe /K C:\Users\yourusename\anaconda3\Scripts\activate.bat

3. Copy Path of Anaconda Navigator Icon

  • Type Anaconda navigator on the search box of Windows 10 or 11
  • Right click to open the location
  • Right click on Anaconda navigator(anaconda3)
  • Right click Properties
  • Click Change icon

Copy icon path into text editor, it looks as the follows:
%USERPROFILE%\anaconda3\Menu\anaconda-navigator.ico

 

Fig. 7. Path of Anaconda Navigator Icon

4. Add Anaconda Prompt to the Windows Terminal

Step 1: Open the Setting of the Windows Terminal

  • Open the Windows Terminal
  • Click the down arrow and hit Setting

 

Fig.8. Go to setting of the Windows Terminal

Step 2. Open JSON File of the Windows Terminal

  • Go to the last of the left menu
  • Hit Open JSON File

 

Fig.9. Open JSON File of Windows Terminal

Step 3. Copy cmd.exe code snippet and modify it

Copy cmd.exe code snippet, which is easy to edit and something looks like the following:

   {
      "commandline": "cmd.exe",
      "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
      "hidden": false,
      "name": "Command Prompt"
    },

But it maybe looks a little bit of difference on Windows 10 and 11.

  • Paste it next line after it
  • Then change “commandline:” part to the edited Target of Anaconda Prompt above. It looks something like follows:
"commandline": cmd.exe /K C:\Users\yourusename\anaconda3\Scripts\activate.bat

Step 4. Add “icon:” line

You can add "icon:" line after any other lines, say after “hidden”: line here for example.

"hidden": false, "icon": "%USERPROFILE%\\Anaconda3\\Menu\\anaconda-navigator.ico",

Step 5. Modify the “guid” line number

Change the “guid’ number to make unique from others, we can just change the last few numbers, say6101 to 4523, or whatever you like.

Step 6. Change the “name” line

Change “Command Prompt” on the “name” line into “Anaconda PowerShell”, which is as follows:

"name": "Anaconda Prompt"

If it is not the last line, please add the comma “,” at the end of the line.

The final modified version looks like the follows:

{
     "commandline": "cmd.exe /K C:\\Users\\Sigmund\\Anaconda3\\Scripts\\activate.bat",
     "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa4523}",
     "icon": "%USERPROFILE%\\Anaconda3\\Menu\\anaconda-navigator.ico",
     "hidden": false,
     "name": "Anaconda Prompt"
    },

Step 6. Save the file

Go to file and then click save to save the edited JSON file. When you reopen the Windows Terminal, you will see the Anaconda Prompt with its navigator icon on the menu of the Windows Terminal, which looks like the title image at the very beginning.

5. Video Version

If you like to watch a video version of this article, please go ahead to watch it and click to subscribe for more tips.

More Information:

If you are interested in Python related courses on Python fundamental, Jupyter Notebook, Data Science, Wavelet Transforms, Machine Learning, and so on, welcome you to my online school —  Deepsim Academy.

Bookmark
ClosePlease login
0 - 0

Thank You For Your Vote!

Sorry You have Already Voted!

Please follow and like me:

Leave a Reply

Your email address will not be published. Required fields are marked *