Setting up Python Virtual Environments | Linux | VS Code

preview_player
Показать описание
A virtual environment is a tool that helps to keep dependencies required by different projects separate by creating isolated python virtual environments for them. This is one of the most important tools that most of the Python developers use.

Why do we need a virtual environment?
Imagine a scenario where you are working on two web-based python projects and one of them uses a Django 1.9 and the other uses Django 1.10 and so on. In such situations virtual environment can be useful to maintain dependencies of both the projects.

When and where to use a virtual environment?
By default, every project on your system will use these same directories to store and retrieve site packages (third party libraries). How does this matter? Now, in the above example of two projects, you have two versions of Django. This is a real problem for Python since it can’t differentiate between versions in the “site-packages” directory. So both v1.9 and v1.10 would reside in the same directory with the same name. This is where virtual environments come into play. To solve this problem, we just need to create two separate virtual environments for both the projects. The great thing about this is that there are no limits to the number of environments you can have since they’re just directories containing a few scripts.
Рекомендации по теме
Комментарии
Автор

I was struggling set up sqlite3 for my python project, so i wanted to use a virtualenv instead, your video provided a working explanation to do that on my linux mint, which I couldn't find on yt. so you see, you are a lifesaver, thank you

wireless
Автор

With more practice you can make it in podcast. Good work

kithinjicharles