I think Python's virtual environments (managed either with venv o pipenv) are just designed to isolate one Python environment from another, that is, for instance, make sure that your Python application runs with the exact version of packages it requires, and does not conflict with another application's requirements.
This has nothing to do with non-Python system tools.
So, if you want to build your own experiment environment, with your version of git and postgreSQL etc, your best bet is creating a Virtual Machine (VM) or a container. If you are new to both, perhaps the VM is easier to understand and use (it is like having a dedicated PC for experiments).
That said, in Unix systems it is certainly feasible to manage various version of tools (like git) in the same machine. If you are a developer, you might want to install them locally (e.g. under ~/local/tool-version
) and create setup shell scripts that add those tools to the PATH
, so that shell will find them instead of the system ones.
For instance you could create a file such as my-git.sh
#!/bin/bash
PATH=~/local/git-1.2.3/bin:$PATH
export PATH
Then when you want to use the tool, in your terminal you could type
$ source my-git.sh
and after this the next time you invoke git in your shell, it will use the binary in ~/local/git-1.2.3/bin
(provided there is one there) instead of the system one.
However, a setup like this is much more involved, and does not provide compete isolation (e.g. shared libraries are still the one installed in your sytem)
Hope this helps.