Where is virtualenvwrapper.sh?
I don't know what's more embarrassing: that I don't know how to go about finding the answer to this question myself, or that it has to be asked at all in the first place, but...
where does
apt-get
put thevirtualenvwrapper.sh
script after it installsvirtualenvwrapper
?
I'm at wits' end...
% sudo apt-get install virtualenvwrapper
...
% rehash
% which virtualenvwrapper.sh
virtualenvwrapper.sh not found
% which virtualenvwrapper
virtualenvwrapper not found
% find / -path /media -prune -o -name virtualenvwrapper.sh
/media
% dpkg-query -L virtualenvwrapper | grep 'virtualenvwrapper\.sh'
% sudo apt-get install virtualenvwrapper
Reading package lists...
Building dependency tree...
Reading state information...
virtualenvwrapper is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
I've run out of things to try: apt-get
says virtualenvwrapper
is already installed, but I can't find any sign of virtualenvwrapper.sh
anywhere.
UPDATE: Well, I just discovered that the file
/etc/bash_completion.d/virtualenvwrapper
...looks very much like virtualenvwrapper.sh
. I can't tell whether this file was put there by apt-get
when I ran apt-get install virtualenvwrapper
(the file's mdate is several months ago), but if it was, then I'm mystified by the apparent stupidity of the arrangement... For one thing, not everyone uses bash
(I happen to use zsh
). For another, one may want to run virtualenvwrapper.sh
at times other than startup... I'm sure I'm missing something major here, but on the surface, it sure looks like the apt-get
installation of virtualenvwrapper
is plain retarded... At any rate, it wasted about three hours of my time...
From /usr/share/doc/virtualenvwrapper/README.Debian
:
In contrast to the information in /usr/share/doc/virtualenvwrapper/en/html/index.html this package installs virtualenvwrapper.sh as /etc/bash_completion.d/virtualenvwrapper. Virtualenvwrapper is enabled if you install the package bash-completion and enable bash completion support in /etc/bash.bashrc or your ~/.bashrc. If you only want to use virtualenvwrapper you may just add source /etc/bash_completion.d/virtualenvwrapper to your ~/.bashrc.
Yes, it's a bit hard to find :D
On Ubuntu, the script's location is:
/usr/share/virtualenvwrapper/virtualenvwrapper.sh
So if you've installed virtualenvwrapper
with the package manager, you must add the following lines into your ~/.bashrc
:
export WORKON_HOME=~/.virtualenvs
source /usr/share/virtualenvwrapper/virtualenvwrapper.sh
Also, remember to reload your ~/.bashrc
with:
$ source ~/.bashrc
If everything worked well, then you'll be able to run mkvirtualenv
like:
mkvirtualenv --python="/usr/bin/python3" venv_name