pip install --user vex and
vex --path venv* $SHELL
I have used python virtual environments for years without caring about its details. I recently had to because of heavy changes to my terminal setup, including the change of shell from the boring bash to fish shell, which comes by default with goodies. I am not shitting on bash since it is probably the best choice for system independent non-interactive shell scripts: the fish shell is designed for interactive use, which is what I do.
Using bash, I can “activate” the virtual environment by running the usual
source whatever/bin/activate. This adds a
(VENV) text to the beginning of the shell line (by changing the
PS1 environment variable). The equivalent for the fish shell is
source whatever/bin/activate.fish. Now, besides the fact that the
activate.fish coming with the default python on Ubuntu 16.04 (currently my OS) is buggy and I had to create a virtual environment by using python3.6 (from PPA), this approach sucks because the bobthefish theme I use already includes virtualenv information. After all, it makes more sense to setup how the shell line looks once instead of replicating the functionality in every
cd my-fantastic-project python3 -m venv venv35 vex --path venv35 fish
This gives me a nice fish shell with the correct $PATH. The
deactivate script is replaced by simply exiting the shell with the usual
Still reading? I’m replacing the tab/split interface of Konsole with tmux, which besides advanced tab/split also supports sessions. In this way I am more independent from the terminal emulator. I just have to be sure that tmux receives all the keystrokes by checking my system settings for the keyboard shortcuts.