Sunday, October 27, 2019

Python : What is difference Between VirtualEnv and Conda



Conda environments are essentially a replacement for virtualenv. Both conda environments and virtualenv are aimed at creating an “environment” with isolated package installs. They aim to solve the problem of having multiple python projects on the same system with conflicting package requirements. If you have project A that requires tensorflow-1.8 and project B that uses tensorflow-1.9, these environments allow you to have the right version installed for each project.

The main difference between the two is that conda is a bit more full featured/”magic”. Conda has dedicated syntax for creating environments and installing packages, and can also manage installing different versions of python too. For virtualenv, you just activate the environment and then use all the normal commands.

For example, for conda the command for a new environment named “myenv” using python 3.4, scipy version 0.15.0, and packages astroid and babel of any version:

conda create -n myenv python=3.4 scipy=0.15.0 astroid babel



virtualenv --python=/usr/bin/python3.4 myenv
source myenv/bin/activate
pip install scipy==0.15.0
pip install astroid
pip install babel



References:
https://www.quora.com/What-is-the-difference-between-python-virtualenv-and-a-conda-environment


No comments:

Post a Comment