Blog Post

virtualenv 101

🗓 September 21, 2014 :: 🕑 1 min read :: 👏 0 💬 0

virtualenv is a tool that allow users to create an isolated Python environment. It works by creating a working copy of Python runtime (specified by you) specific to a project without polluting other projects.

Installation

$ pip install virtualenv

Usage

$ mkdir ~/prj/envs; cd ~/prj/envs # creating virtual env $ virtualenv myfirstenv # use -p to specify Python runtime of your choice # activating env $ . myfirstvenv/bin/activate # install other libraries, installation will stay local to the virtual env $ pip install Flask # e.g. Flask, Django etc... # deactivate env $ deactivate

Note

Rather than managing the environments manually. You can use virtualenvwrapper (available via pip) to manage virtual environments.

Usage

# create env $ mkvirtualenv myfirstenv # activate env $ workon myfirstenv # deactivate env $ deactivate # remove env $ rmvirtualenv myfirstenv #list all envs $ lsvirtualenv
Ben Shi

virtualenv is a tool that allow users to create an isolated Python environment. It works by creating a working copy of Python runtime…

https://hbish.com/virtualenv-101/


Fetching Replies...