Question

I have virtualenv and virtualenvwrapper installed, but when trying to setup an application, I enter mkvirtualenv --no-site-packages I get the following error:

-bash: mkvirtualenv: command not found

I am not sure how to troubleshoot this. As a beginner, I'd be grateful for any help.

Was it helpful?

Solution

You need to enable virtualenvwrapper as described in its docs.

Shell Startup File

Add three lines to your shell startup file (.bashrc, .profile, etc.) to set the location where the virtual environments should live, the location of your development project directories, and the location of the script installed with this package:

export WORKON_HOME=$HOME/.virtualenvs 
export PROJECT_HOME=$HOME/Devel
source /usr/local/bin/virtualenvwrapper.sh

After editing it, reload the startup file (e.g., run source ~/.bashrc).

OTHER TIPS

This can actually vary a little bit depending on how you installed it. If you installed it on Ubuntu with apt, the virtualenvwrapper functions are actually rolled into a bash completion file (figuring that out was fun!).

export WORKON_HOME=$HOME/.virtualenvs 
export PROJECT_HOME=$HOME/Devel
possible_scripts='/usr/local/bin/virtualenvwrapper.sh /etc/bash_completion.d/virtualenvwrapper'
for script in $possible_scripts; do
  [[ -f $script ]] && source $script
done
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top