Ubuntu 19.10 seems to have what feels like a somewhat non-standard virtualenvwrapper package which is causing me issues. But it does seem more sensible to install pip, virtualenv and virtualenvwrapper from a package than to pollute the global environment outside of the virtualenv.
Most instructions (e.g.) suggest to add the following to .bashrc:
export WORKON_HOME=$HOME/.virtualenvs
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
source /usr/local/bin/virtualenvwrapper.sh
However, Ubuntu installs virtualenvwrapper.sh
in /usr/share/virtualenvwrapper/
:
$ dpkg -L virtualenvwrapper
/.
/usr
/usr/share
/usr/share/bash-completion
/usr/share/bash-completion/completions
/usr/share/bash-completion/completions/virtualenvwrapper
/usr/share/doc
/usr/share/doc/virtualenvwrapper
/usr/share/doc/virtualenvwrapper/README.txt
/usr/share/doc/virtualenvwrapper/copyright
/usr/share/man
/usr/share/man/man1
/usr/share/man/man1/virtualenvwrapper.1.gz
/usr/share/virtualenvwrapper
/usr/share/virtualenvwrapper/virtualenvwrapper.sh
/usr/share/virtualenvwrapper/virtualenvwrapper_lazy.sh
/usr/share/doc/virtualenvwrapper/README.Debian
/usr/share/doc/virtualenvwrapper/changelog.Debian.gz
/usr/share/man/man1/add2virtualenv.1.gz
...
/usr/share/man/man1/workon.1.gz
Fine, I can bodge it and source from that location instead, but README.Debian
implies bash-completion should pick it up:
In contrast to the information in /usr/share/doc/virtualenvwrapper/html/index.html this package installs virtualenvwrapper.sh as /usr/share/virtualenvwrapper/virtualenvwrapper.sh the lazy version is installed as /usr/share/virtualenvwrapper/virtualenvwrapper_lazy.sh.
Virtualenvwrapper is enabled if you install the package bash-completion and enable bash completion support in /etc/bash.bashrc or your ~/.bashrc. The bash completion file in /etc/bash_completion.d/virtualenvwrapper sources the lazy version of virtualenvwrapper by default but can be configured to load the full version instead.
If you only want to use virtualenvwrapper you may just add
source /usr/share/virtualenvwrapper/virtualenvwrapper.sh
to your ~/.bashrc or ~/.zshrc.
My .bashrc already appears to already contain the necessary to enable bash completion support:
# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi
I'm running a stock Ubuntu 19.10 VM sourced from osboxes.org inside VMWare Player on Windows 10.
0 Answers