Python for Data Science Series - Part 2
Hello all,
This is the second article in the series Python for Data Science. If you have missed the first article, please refer it for better understanding.
1. Creating and Managing Virtual Python Environments - Anaconda:
Anaconda documentation page is well documented in explaining creating and managing virtual conda enviroments.
Video Tutorial on the same is available here.
Here are few of those commands which will be handy.
- Creating Python Virtual Environment:
To create a virtual environment with name ENVNAME and with python version PYTHONVERSION
conda create --name ENVNAME python=PYTHONVERSION
- Cloning Virtual Environment from existing one:
To make a copy of your existing virtual environment (OLDENVNAME) to a different name (NEWENVNAME)
conda create --name NEWENVNAME --clone OLDENVNAME
- List the available Virtual Environment
To get the available virtual environments in your PC, use the following command
conda env list
- To Install packages in Virtual Environment
To install package NEWPACKAGETOINSTALL in your virtual environment NEWENVNAME
conda activate NEWENVNAMEpip install NEWPACKAGETOINSTALL
- Install using requirement text/YAML file from your Virtual Environment
conda env create --name NEWENVNAME -f environment.yml
conda create --name NEWENVNAME --file spec-file.txt
- Extract package requirements file
conda env export > environment.yml
Comments
Post a Comment