4 ms·
There is not an actual need to activate for most use cases. I almost always just do python3 -m venv .venv .venv/bin/pip install whatever .venv/bin/python
by milliams 4y ago
There is not an actual need to activate for most use cases. I almost always just do
python3 -m venv .venv
.venv/bin/pip install whatever
.venv/bin/python foo.py
- nerdponx 4y agoThis is what I do in 99% of my projects. Or I use a tool like Hatch that creates envs for me, and I can use `hatch run ...` instead of manually invoking the path. People like to complain about Python, but `./venv/bin/foo` is basically identical to `./node_modules/.bin/foo` and I don't see why the former deserves so much hate.
- gymbeaux 4y agoI think it's because you "have to" run a command to activate the virtual environment AKA use files that are already in the directory. With NodeJS (or any other platform/language), it's implied that the files in your current directory are the files you want to use for building/execution
- twic 4y agoExplicit is better than implicit, after all.
- tomjakubowski 4y agoJust to give an example where activate is needed, if you have the tool programs `a` and `b` installed in the venv, and `a` invokes `b` (invokes as opposed to importing python modules), then: .venv/bin/a wouldn't be able to invoke b without activating the venv or otherwise putting .venv/bin on the PATH.