Sunday, October 17, 2021

python virtual environments

 Install module venv, if not available globally.


Then, create a virtual environment on current directory as a subfolder venv as below.

python3 -m venv venv


Activate the virtual environment, using below command.


For mac:

source venv/bin/activate


For windows:

venv\Scripts\activate

More detail:

mkdir tutorial

cd tutorial

python3 -m venv venv

source venv/bin/activate


Then, the console will be appended with the virtual environment folder name.

Here you can install the modules as below.

Example:

pip install Django


No comments:

Post a Comment