Skip to content
Myr

virtualenv.md

This file

Path

docs/virtualenv.md

58 lines · 1.2 KiB · Markdown

Last changed by

Move Wincmd and Virtualenv docs from reST to MyST (#2954)Rowlando13before adoption499bbee

History of this file

Take it

Move Wincmd and Virtualenv docs from reST to MyST (#2954)Rowlando13before adoption499bbee

lines 1–58why, one step back
1(virtualenv-heading)=
23# Virtualenv45## Why Use Virtualenv?67You should use [Virtualenv](https://virtualenv.pypa.io/en/latest/) because:89- It allows you to install multiple versions of the same dependency.10- If you have an operating system version of Python, it prevents you from changing its dependencies and potentially11 messing up your os.1213## How to Use Virtualenv1415Create your project folder, then a virtualenv within it:1617```console18$ mkdir myproject19$ cd myproject20$ python3 -m venv .venv21```2223Now, whenever you want to work on a project, you only have to activate the corresponding environment.242526```{eval-rst}27.. tabs::2829 .. group-tab:: OSX/Linux3031 .. code-block:: text3233 $ . .venv/bin/activate34 (venv) $3536 .. group-tab:: Windows3738 .. code-block:: text3940 > .venv\scripts\activate41 (venv) >42```4344You are now using your virtualenv (notice how the prompt of your shell has changed to show the active environment).4546To install packages in the virtual environment:4748```console49$ pip install click50```5152And if you want to stop using the virtualenv, use the following command:5354```console55$ deactivate56```5758After doing this, the prompt of your shell should be as familiar as before.