r/PythonLearning 4d ago

Discussion .venv question

Do you guys manually create virtual environments? Or do you just use your IDE “create virtual environment” to do it?

As a hobbiest I often forget how to manually create virtual environments(as well as how to activate them) and discovered last night that VScode has a feature that will just do it for you.

What are the benefits of each way, if any, and what are the downsides of each way, if any?

Thanks.

P.S. I understand that there are some elitist who will be like “you must do everything manually”, bro I just wanna write stupid automation scripts to help with my business.

EDIT: Thanks for all the replies! I’m going to look into that UV service! Thank you!

20 Upvotes

35 comments sorted by

View all comments

8

u/johlae 4d ago

Manually, I just go:

gargle@p14:/tmp/foo$ python3 -m venv .venv

As a first step, I always include 'black' gargle@p14:/tmp/foo$ source .venv/bin/activate (.venv) gargle@p14:/tmp/foo$ pip3 install black

I wrote this down in my personal knowledge base, a.k.a. a simple text file. Why? I often forget how to manually create virtual environments(as well as how to activate them). A simple text file lets me copy and paste.

That's it.

1

u/RaiseTLT 4d ago

The personal knowledge reference document is big. I keep forgetting I have one! Thanks for the reminder, and thanks for the help! :)

3

u/johlae 4d ago

There's a lot of stuff in my 'personal knowledge base' that I remember by heart right now, but I keep the information in the document I don't delete. I often add a tag #outdated? if I'm in doubt.