The Mambaforge or Anaconda base Python environment can be added to the Windows Environmental Variables path during installation which makes it accessible in the Windows Terminal.
This option is for advanced use, for example when a code from another programming language wants to use Python in the base Python environment to run a Python script.
This option is not selected by default:
If selected, the option is highlighted as NOT recommended as it can lead to conflicts with other applications:
Instead you are recommended to use the Mambaforge Prompt or Anaconda Powershell Prompt respectively.
The Windows Environment Variable Path
The Windows Environmental Variables Path can be checked by right clicking the Start Button and selecting System:
Then selecting Advanced System Settings:
Then Advanced and Environmental variables:
Select Path and then Edit:
If Mambaforge has been added to the path the following 5 entries will display:
%USERPROFILE%\mambaforge %USERPROFILE%\mambaforge\Library\mingw-w64\bin %USERPROFILE%\mambaforge\Library\usr\bin %USERPROFILE%\mambaforge\Library\bin %USERPROFILE%\mambaforge\Scripts
If Anaconda3 has been added to the path the following 5 entries will display:
%USERPROFILE%\anaconda3 %USERPROFILE%\anaconda3\Library\mingw-w64\bin %USERPROFILE%\anaconda3\Library\usr\bin %USERPROFILE%\anaconda3\Library\bin %USERPROFILE%\anaconda3\Scripts
Additional entries may be added for other programs and should be unmodified.
Launching Python from the Windows Terminal
After the path is modified, close down any open Windows Terminals.
Right click the Start button and select Windows Terminal:
Windows PowerShell Copyright (C) Microsoft Corporation. All rights reserved. Install the latest PowerShell for new features and improvements! https://aka.ms/PSWindows PS C:\Users\Phili>
Windows PowerShell Copyright (C) Microsoft Corporation. All rights reserved. Install the latest PowerShell for new features and improvements! https://aka.ms/PSWindows PS C:\Users\Phili> python
The Python version should now display:
PS C:\Users\Phili> python Python 3.10.10 | packaged by conda-forge | (main, Mar 24 2023, 20:00:38) [MSC v.1934 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information.
Followed by the Python Prompt:
Note: If the Windows Store opens, Python is not properly added to the Windows Environmental Variables Path.
Any Python libraries required should be installed in the base Python environment as it is the Python environment hard coded path to the Windows Terminal via the Windows Environmental Variables. It is not possible to change Python Environment using the mamba activate or conda activate commands like in the Mambaforge or Anaconda Prompt. For example, the data science library imports can be tested:
>>> import numpy as np >>> import pandas as pd >>> import matplotlib.pyplot as plt
The Anaconda base Python environment will have these installed however in Mambaforge a ModuleNotFoundError will display:
ModuleNotFoundError: No module named 'numpy'