Topic of Contents:
- Opening the Anaconda Python Prompt/Shell/Terminal on Windows 10/11
- Opening the Anaconda Python Prompt/Shell/Terminal on Linux
- Creating an Anaconda Python Virtual Environment Using a Specific Python Version
- Activating the Newly Created Anaconda Python Virtual Environment
- Deactivating the Newly Created Anaconda Python Virtual Environment
- Conclusion
Opening the Anaconda Python Prompt/Shell/Terminal on Windows 10/11
To open the Anaconda Python prompt/shell/terminal on Windows 10/11, search for “apps: anaconda” from the start menu[1] and click on the “Anaconda Prompt” app[2].
The Anaconda Python prompt/shell/terminal should be opened.
Opening the Anaconda Python Prompt/Shell/Terminal on Linux
To open the Anaconda Python prompt/shell/terminal on Linux, open a Terminal app and run the following command:
The Anaconda Python prompt/shell/terminal should be opened.
Creating an Anaconda Python Virtual Environment Using a Specific Python Version
To create an Anaconda Python virtual environment like “tf-gpu” (let’s say) using a specific version of Python (i.e. Python 3.10), run the following command:
Anaconda Python may need to install some extra packages to install the version of Python that you want to use for the new Anaconda Python virtual environment. To confirm the installation, press “y” and then press <Enter>.
The required Anaconda Python packages are being installed and a new Anaconda Python virtual environment is being created.
At this point, the required Anaconda Python packages should be installed and a new Anaconda Python virtual environment should be created.
You can list all the available Anaconda Python virtual environments with the following command:
As you can see, the newly created Anaconda Python “tf-gpu” virtual environment is on the list.
Activating the Newly Created Anaconda Python Virtual Environment
The default Anaconda Python virtual environment base is activated when you open the Anaconda Python prompt/shell/terminal.
To activate the newly created Anaconda Python “tf-gpu”virtual environment, run the following command:
The Anaconda Python “tf-gpu” virtual environment should be activated.
As you can see, Python 3.10.x is being used for the Anaconda Python “tf-gpu” virtual environment.
Deactivating the Newly Created Anaconda Python Virtual Environment
To deactivate the Anaconda Python “tf-gpu” virtual environment, run the following command:
The Anaconda Python “tf-gpu” virtual environment should be deactivated and the default Anaconda Python environment base should be activated.
Conclusion
In this article, we showed you how to create an Anaconda Python virtual environment using a specific version of Python. We also showed you how to activate and deactivate the newly created Anaconda Python virtual environment.