How to create an Anaconda virtual environment on Linux?

To create an Anaconda virtual environment on Linux, you can follow these steps:

  1. Open the terminal.
  2. Enter the following command to create a new virtual environment, where “myenv” is the name of the environment, you can choose a suitable name yourself:
  3. Create a conda environment named myenv.
  4. After executing the above command, you will be prompted to install the required packages for the new environment. Enter “y” and press enter to confirm.
  5. Activate the new environment after the installation is completed.
  6. activate myenv in conda
  7. Once the environment is activated, you can install the necessary software packages within that environment, for example:
  8. Install numpy using conda.
  9. Alternatively
  10. install numpy using pip
  11. The NumPy library will be installed in the new environment.
  12. After you have finished using the virtual environment, you can use the following command to exit the environment:
  13. disable conda
  14. If you wish to delete this virtual environment, you can use the following command:
  15. Delete all packages in the conda environment named “myenv”.
  16. This will delete the environment named myenv along with all of its installed packages.

Please note that in the above operations, conda is the command line tool for Anaconda, and pip is the package management tool for Python. After installing Anaconda, these two tools will be automatically installed and configured.

bannerAds