virtualenv.rst
This file
Path
docs/virtualenv.rst
54 lines · 1.3 KiB
Last changed by
Merge stable into main (#2799)Rowlando13before adoptiond791537
History of this fileTake it
1.. _virtualenv-heading:23Virtualenv4=========================56Why Use Virtualenv?7-------------------------89You should use `Virtualenv <https://virtualenv.pypa.io/en/latest/>`_ because:1011* It allows you to install multiple versions of the same dependency.1213* If you have an operating system version of Python, it prevents you from changing its dependencies and potentially messing up your os.1415How to Use Virtualenv16-----------------------------1718Create your project folder, then a virtualenv within it::1920 $ mkdir myproject21 $ cd myproject22 $ python3 -m venv .venv2324Now, whenever you want to work on a project, you only have to activate the25corresponding environment.2627.. tabs::2829 .. group-tab:: OSX/Linux3031 .. code-block:: text3233 $ . .venv/bin/activate34 (venv) $3536 .. group-tab:: Windows3738 .. code-block:: text3940 > .venv\scripts\activate41 (venv) >424344You 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 $ pip install click4950And if you want to stop using the virtualenv, use the following command::5152 $ deactivate5354After doing this, the prompt of your shell should be as familiar as before.