Virtual Environment

  • Python virtual environments is to create an isolated environment for Python projects.
  • Each project can have its own dependencies, regardless of what dependencies every other project has.
  • The great thing about this is that there are no limits to the number of environments you can
    have since they’re just directories containing a few scripts.

Install Virtualenv

pip install virtualenv

Start by making a new directory to work with:
mkdir pythonvm
cd pythonvm

python -m venv env

If you are working with multiple version of python remember your python alias that may differ according to your python version.

$ python3 -m venv env

How Folder Structure Looks Like?

├── lib
│ ├── pip
│ ├── pip-20.2.3.dist-info
│ ├── pkg_resources
│ ├── setuptools
│ ├── setuptools-49.2.1.dist-info
│ ├── easy_install
├── include
├── Scripts
│ └── python
│ └── activate /deactivate
└── pyvenv.cfg

Active & Deactivate VM

  • Navigate to Scripts directory : cd Scripts
  • Then run activate.bat
  • For Deactivate just type deactivate in the current directory regardless of scripts Folder

0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *