File tree Expand file tree Collapse file tree 1 file changed +46
-0
lines changed
Expand file tree Collapse file tree 1 file changed +46
-0
lines changed Original file line number Diff line number Diff line change 1+ Virtual Environment
2+ ========================================
3+
4+ ## What is a virtual environment?
5+ - A isolated Python environment that is installed into a directory.
6+ - Maintains it's own copy of Python and pip (Python's package manager).
7+ - When activated all Python operations will route to the Python interpreter within the virtual environment.
8+
9+ ## What are the benefits?
10+ - Keeps your global site-packages directory clean and manageable.
11+ - Keeps system or user installed Python and it's libraries untouched.
12+ - Solves the problem of “Project X depends on version 1.x but, Project Y needs 4.x”.
13+ - Development will not interfere with the System or the user's python.
14+ - All libraries installed in the virtual environment will only be used within that environment.
15+
16+ ## How to install?
17+
18+ $ pip install virtualenv
19+
20+ ## How to create a virtual environment?
21+ In current directory:
22+
23+ python -m venv .
24+
25+ In a subdirectory that does not exist:
26+
27+ python -m venv ./new_dir
28+
29+ ## How to activate a virtual environment?
30+ ##### Windows
31+ ```
32+ new_dir\scripts\activate.bat
33+ ```
34+ ##### MacOS/Linux (bash)
35+ ```
36+ . new_dir/bin/activate
37+ ```
38+ ## How to deactivate a virtual environment?
39+ ##### Windows
40+ ```
41+ <clone_root>\env\scripts\deactivate.bat
42+ ```
43+ ##### MacOS/Linux (bash)
44+ ```
45+ deactivate
46+ ```
You can’t perform that action at this time.
0 commit comments