Local And Global Python Executable

HELLO

In the Video, We have created our personal Virtual Environment where we can download several libraries of python and it will work in that project only. So Why do we require the basic python executable for every different project, Can’t we simply run the command by Global Python Executable?

The question is the same for other libraries. Ultimately we have to download them globally so that we can copy them to our personal project.

Thank You

Hi @sarthakagg105
Sometimes, it is useful to use virtual env than the global one.
Suppose you are working on a project with python version 3.7 and now you want to create another project in that you can use the latest version of 3.10 but in case you update the whole python version than the code written for version 3.7 might bring some issue with version 3.10. Similar explaination will go for libraries also. Thus virtual environments let you have a stable, reproducible, and portable environment. You are in control of which packages versions are installed and when they are upgraded.

Hope this might helps :slight_smile:

Thank You Sir for Replying. Okay I understood. So by upgrading global python package it could affect every old project that we have done.

So sir I am creating different project have runtime.txt and requirements.txt. But i am not creating a virtual environment for every folder i am creating so should i need to create one?

Hi @sarthakagg105 its advised to create a virtual enviroment for every project, as it just make your code reproducible and portable. Rest it totally depends on you

Hope it might help :slight_smile:

Hey Again So I am creating a different project for a different lecture so as said in the videos that we need to create a virtual environment for every project so should I give the command virtualenv to every project on cmd when I am inside that directory or should I use a virtualenv outside and make every project in that by using the same virtualenv? thanks

Hi @sarthakagg105 Its totally depends on you, either way would work.