Hacker News new | ask | show | jobs
by simonw 1835 days ago
Virtual environments are, sadly, absolutely crucial for Python beginners to get their heads around if they are to do anything more advanced then "hello world".

When I'm getting someone started I usually say:

"There is a magic incantation involved in Python development called 'activating your virtual environment' - if stuff isn't working as you expect, check that you have done this. Development environments are the hardest thing about learning to program. I'm so sorry."

1 comments

pip freeze > requirements.txt

When first learning python and virtual environments, it took me a little bit of time to understand that the virtual environment is basically a clean slate.

The command above saved a lot of time. I’d go so far as to having a set of requirements files ready to go for certain types of projects just to get started.

Check out pipenv, it really is a lot simpler.