Sep-12-2022, 12:02 AM
(Sep-11-2022, 08:23 PM)gabriel789 Wrote: when you say virtual environment you mean like virtualboxCan say it similar but instead of creates a OS,it's make a new stand alone Python environment.
It's build into Python trough venv or there 3-party lib like Poetry.
Purpose of Python virtual environments is to create an isolated environment for Python projects,
means that each project can have its own dependencies,regardless of what dependencies OS Python or other project has.
Example.
# Make G:\div_code λ python -m venv new_env # Cd in λ cd new_env\ # Activate # Linux <source bin/activate> G:\div_code\new_env λ G:\div_code\new_env\Scripts\activate # Install (new_env) G:\div_code\new_env λ pip install requests Collecting requests ..... Successfully installed certifi-2020.12.5 chardet-4.0.0 idna-2.10 requests-2.25.1 urllib3-1.26.3 # List packages in environment (new_env) G:\div_code\new_env λ pip list Package Version ---------- --------- certifi 2020.12.5 chardet 4.0.0 idna 2.10 pip 20.2.3 requests 2.25.1 setuptools 49.2.1 urllib3 1.26.3 # Show (new_env) G:\div_code\new_env λ pip show requests Name: requests Version: 2.25.1 Summary: Python HTTP for Humans. Home-page: https://requests.readthedocs.io Author: Kenneth Reitz Author-email: [email protected] License: Apache 2.0 Location: g:\div_code\new_env\lib\site-packages Requires: idna, certifi, chardet, urllib3