You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: programming_fundamentals/python_part_2/README.md
+15
Original file line number
Diff line number
Diff line change
@@ -20,6 +20,21 @@ It is recommended that this lesson be completed using Python 3.8. Other version
20
20
21
21
***Note: During this lesson you will learn about Python Virtual Environments and Libraries and practice using these tools.***
22
22
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:
0 commit comments