SOHO : Small Office Home Office
Freeware - Opensource software tips, tricks, tweaks & fixes for managing, securing, improving the performance of SOHO Desktop, Laptop, Networks

Wednesday, September 16, 2020

python3 [virtualenvwrapper] : set up virtualenv in ubuntu LTS

Setting up virtual environment in ubuntu lts.


  • Installing virtualenv: Install into user folder instead of system wide

sudo apt-get install python3-pip

python3 -m pip install --user virtualenvwrapper

  • Config virtualenvwrapper

nano ~/home/username/.bashrc

  • Add below lines to .bashrc

#setup virtualenv

export WORKON_HOME=$HOME/.virtualenvs

export ROJECT_HOME=$HOME/Devel

export VIRTUALENVWRAPPER_PYTHON = /usr/bin/python3

export VIRTUALENVWRAPPER_SCRIPT=/home/username/.local/bin/virtualenvwrapper.sh

source /home/username/.local/bin/virtualenvwrapper.sh

  • Enable config 

source ~/.bashrc

  • For below error or screenshot :  export VIRTUALENVWRAPPER_PYTHON=/usr/bin/virtualenvwrapper.sh

/usr/bin/python: No module named virtualenvwrapper

virtualenvwrapper.sh: There was a problem running the initialization hooks.

If python could not import the module virtualenvwrapper.hook_loader,

check that virtualenvwrapper has been installed for 

VIRTUALENVWRAPPER_PYTHON=/usr/bin/python and that python is set properly.



  • Quick-Start

Run: workon

A list of environments, empty, is printed.

Run: mkvirtualenv temp

A new environment, temp is created and activated.

Run: workon

This time, the temp environment is included.

Ref: https://virtualenvwrapper.readthedocs.io/en/latest/install.html#basic-installation

No comments:

Post a Comment