\<< [[§ Python]] --- # TL;DR Virtual environments help you keep versions and packages separate from your main Python installation. This is useful to replicate your project in any machine and is considered best practice for all developers. --- # How to start ``` python -m venv venv ``` Creates a virtual environment (called venv) in the current directory. After creating it, you need to activate it by typing: ``` venv\Scripts\activate.bat ``` (When the selected terminal is CMD) or ``` venv\Scripts\Activate.ps1 ``` (When the selected terminal is PowerShell) > [!Attention] Potential Issue when running for the first time: > ![[publish-asset 20221228144836.png]] > > Solution: > ![[publish-asset 20221228145842.png]] --- # Explanation When working with Python, if you are a beginner you are usually not aware what goes on on the background every time you follow tutorials on the internet. Most times, specially in the Data space, people will recommend to install Anaconda, which is a massive package containing several libraries and software that you will probably never need. Not to mention that it is a licensed bundle, so you might run into problems when using it for work. Another approach is to install python and follow up supplementing it with the libraries you need by installing them using pip. This can also potentially lead to unnecessary bloat as you install things and not delete them once they are not necessary anymore. One way to avoid that is by using Virtual Environments.