Create Virtual Environment in Python

Опубликовано: 05 Декабрь 2022
на канале: Developer Bites
3
0

A virtual environment in python isolates a project from other projects.

1. Installs the package virtualenv to create a virtual environment.

sudo pip install virtualenv

2. On windows, open the command prompt as Administrator and type the same command:

pip install virtualenv

3. To activate the virtual environment in linux / Mac:
cd your-virtual-environment-directory
source bin/activate

4. On Windows:

cd your-virtual-environment-directory
Scripts\activate

5. To come out of the virtual environment, just type the following command. It is the same for all the operating systems (Linux/Mac/Windows):

deactivate