Python virtualenv no activate

Kamal Mustafa - Jan 19 '23 - - Dev Community

My workflow when starting new python project or experimenting with something:-

mkdir myproject
cd myproject
python -mvenv venv
venv/bin/pip install something
venv/bin/python
>>> import something
Enter fullscreen mode Exit fullscreen mode

Look, there's no need to do something like source venv/bin/activate to make use of your virtual environment.

Not using activate also good for documentation like in README as you don't have the two steps commands and people forgot to run the first step problem.

Have ever got into situation where you have to ask, "Have you run source venv/bin/activate?" You don't need to ask this question if you invoke the venv directly.

Of course this is just for quick experimentation. For a real project we're using poetry. And here's labzero our starter project for django.

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .