Skip to content

Commit 0fdc937

Browse files
committed
Virtual ENV creation note
Note about using -m venv rather than virtualenv like in video
1 parent 9e829fb commit 0fdc937

File tree

1 file changed

+15
-0
lines changed
  • programming_fundamentals/python_part_2

1 file changed

+15
-0
lines changed

programming_fundamentals/python_part_2/README.md

+15
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,21 @@ It is recommended that this lesson be completed using Python 3.8. Other version
2020
2121
***Note: During this lesson you will learn about Python Virtual Environments and Libraries and practice using these tools.***
2222

23+
### Creating Virtual Environments
24+
Python 3 includes a library called `venv` for creating virtual environments. This replaces the `virtualenv` library that was used with Python 2 and shown in the video and slides. The recommended way to create virtual environments in Python 3 is:
25+
26+
```python
27+
python3 -m venv venv
28+
```
29+
30+
The `-m` argument to the Python command is used to run a library module. In this case the `venv` library. The second `venv` in the command above is the name of the virtual environment to create. While any name could be used, `venv` is a common practice for naming the virtual enviornment with Python.
31+
32+
Once created, the virtual environment is activated the same way:
33+
34+
```
35+
source venv/bin/activate
36+
```
37+
2338
## DevNet Sandbox
2439
No Sandbox is required for this lesson.
2540

0 commit comments

Comments
 (0)