Created By
Madhava Vemuri, PhD
To do this, open the Anaconda Prompt terminal in your system
You can create a Python environment in Anaconda using the following command. Here the conda environment name you are creating is 'py3.12'. The Python version you are trying to install is 3.12
conda create --name py3.12 python=3.12 -y
You can check if the environment is installed checking in the conda env list. Type the following command in the command prompt
conda env list
You activate the evironment using the command "conda activate". Type the following line in the command prompt. You will see the (base) change to the environment name in this case "py3.12"
conda activate py3.12
You can check the version of the Python installed using the following command. It will be same as the Python version you have created, which is "3.12"
python --version
Conda is recognized by Visual Studio Code by default in some case. You need to invoke the Visual Studio Code using the Anaconda prompt
code
To use the current environment as the desired Python environment in Visual Studio Code, you need to change the Python Interpreter Settings. To do do that go to View > Command Palette or press "Ctrl + Shift + P". Enter "Python: Select Interpreter"
Python: Select Interpreter
You will see a list of Python environments, and select the one you just created
Visual Studio Code has a command prompt built-in. You can access it by going to View > Terminal or using the following keyboard shortcut " ctrl+` ". You can change the terminal to "Command Prompt". You would see "py3.12" activated in the terminal. You can delete the old terminal, listed on the side.