Jeff Severns Guntzel
Jeff Severns Guntzel

Reputation: 657

mkvirtualenv --no-site-packages command getting "command not found" error

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.

Upvotes: 14

Views: 13559

Answers (2)

Justin Force
Justin Force

Reputation: 6342

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

Upvotes: 4

wRAR
wRAR

Reputation: 25693

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).

Upvotes: 26

Related Questions