A Python virtual environment is a way to create isolated Python environments, separate from your system's global Python installation. This allows you to install packages and dependencies for a specific project without affecting other projects or the global Python installation.
To create a virtual environment, you can use the "venv" package. Once venv is installed, you can create a new virtual environment by running the command "venv [environment_name]" in your terminal. This will create a new directory with the specified name, containing a copy of the Python executable and the standard library.
Activating a virtual environment is done by running the command "source [environment_name]/bin/activate" on Linux/macOS or ".[environment_name]\Scripts\activate" on Windows. Once the environment is activated, any packages you install using pip will be installed in the virtual environment, rather than in the global Python installation.
To deactivate a virtual environment, you can run the command "deactivate". And you can also use "pip freeze" command to check the packages installed in your virtual environment.
Sur cette page du site, vous pouvez voir la vidéo en ligne Creating a Virtual Environment in Python (Venv) durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Tommy Tech 16 janvier 2023, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 104 fois et il a aimé 4 téléspectateurs. Bon visionnage!