Python: Getting started with virtualenv 
# install virutalenv
[aesteban@localhost ~]$ sudo pip install virtualenv

# create virtual environment
[aesteban@localhost ~]$ mkdir virt_env
[aesteban@localhost ~]$ virtualenv virt_env/virt1 --no-site-packages
New python executable in /home/aesteban/virt_env/virt1/bin/python
Installing setuptools, pip, wheel...done.
[aesteban@localhost ~]$

# load environment
[aesteban@localhost ~]$ source virt_env/virt1/bin/activate
(virt1) [aesteban@localhost ~]$

# deactivate environment
(virt1) [aesteban@localhost ~]$ deactivate
[aesteban@localhost ~]$
[aesteban@localhost ~]$

# listing installed packages with yolk
[aesteban@localhost ~]$ sudo pip install yolk
[aesteban@localhost ~]$ yolk -l

# installing yolk in our virutal environment
[aesteban@localhost ~]$ source virt_env/virt1/bin/activate
(virt1) [aesteban@localhost ~]$ pip install yolk
(virt1) [aesteban@localhost ~]$ yolk -l


# let's create another environment
(virt1) [aesteban@localhost ~]$ deactivate
[aesteban@localhost ~]$ virtualenv virt_env/virt2 --no-site-packages

# let's switch back to virt1 and install Pylons and SqlAlchemy
(virt1) [aesteban@localhost ~]$ pip install Pylons
...
(virt1) [aesteban@localhost ~]$ pip install SqlAlchemy

# compare virt1 and virt2 using: yolk -l


Big shout-out to:
http://www.simononsoftware.com/virtualenv-tutorial/

Thank you guys!

Comments
Comments are not available for this entry.
2025 By Angel Cool