![]() ![]() So all sorts of wins! It's an important feature to have while doing development (which is why it can be rather frustrating for users when Python distributors leave venv out). an environment for each version of Python that you support). That got us the isolation/separation of only installing things you depend on (and being able to verify that through your testing), as well has having as many environments as you want to go with your projects (e.g. Suddenly you had a way to install projects as a group that was tied to a specific Python interpreter. ![]() So while you could install everything into the same directory as your own code (which you did, and thus didn't use src directory layouts for simplicity), there wasn't a way to install different wheels for each Python interpreter you had on your machine so you could have multiple environments per project (I'm glossing over the fact that back in my the day you also didn't have wheels or editable installs).Įnter virtual environments. Installing into your local directory didn't isolate your installs based on Python version or interpreter version (or even interpreter build type, back when you had to compile your extension modules differently for debug and release builds of Python). This was an issue if you needed to share you code with someone else as you didn't have a way to test that you weren't accidentally wrong about what your dependencies were. It also meant you had no idea what requirements your project actually had since you had no way of actually testing your assumptions of what you needed. This led to issues like version conflicts between what one of your projects might need compared to another one. Installing globally meant you didn't have any isolation between your projects. Both of these approaches had their drawbacks. That meant when you installed something you either installed it globally into your Python interpreter or you just dumped it into the current directory. Why do virtual environments exist?īack in my the day, there was no concept of environments in Python: all you had was your Python installation and the current directory. ![]() After needing to do a deep dive on the venv module (which I will explain later in this blog post as to why), I thought I would explain how virtual environments work to help demystify them. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |