On Mon, 4 Jan 2021 21:07:23 +0400 Abdur-Rahmaan Janhangeer firstname.lastname@example.org wrote:
@Christopher Barker email@example.com
You nailed it! I've used the conda activate command many times. It should in theory be possible in Python
@Chris Angelico firstname.lastname@example.org
Yes mere shell commands passing via Py does not work, maybe a file way with results in current shell as @M.-A. Lemburg email@example.com points out, venv already generates the files. On windows it has an activate.bat
Knowing that, you're a step away from creating a "subshell" solution for *yourself*. For POSIX systems, that would be:
venv-shell.sh: ---- . $1/bin/activate /bins/sh ----
If you want to add "--shell" switch to "python3 -m venv" with that functionality, to benefit the whole mankind, not just yourself, I'm +1. I'd say, you can start writing a patch for that. But I'd warn you that it likely will be rejected, as it will require a bunch of sustained user support (i.e. it won't work as expected on various OSes and various shells).