@@ -20,9 +20,9 @@ Working with Virtual Environments
2020
2121.. rst-class :: large
2222
23- | For every package
23+ | For every package
2424| installed in the
25- | system Python, the
25+ | system Python, the
2626| gods kill a kitten
2727
2828.. rst-class :: build
@@ -49,36 +49,43 @@ Why Virtual Environments?
4949Creating a Venv
5050---------------
5151
52- Since version 3.3, Python has come with a built-in ``venv `` module. This
53- module provides a command you can use to create virtual environments:
54- ``pyvenv ``
52+ Since version 3.3, Python has come with a built-in ``venv `` module.
5553
5654.. rst-class :: build
5755.. container ::
5856
59- The basic usage for this command is as follows :
57+ To use the module, you can run it using your Python 3 executable :
6058
6159 .. code-block :: bash
62-
63- $ pyvenv /path/to/new/environment
60+
61+ $ python -m venv my_env
6462
6563 On Windows you'll need something a bit different:
6664
6765 .. code-block :: posh
68-
69- c:\Temp> c:\Python35\python - m venv myenv
66+
67+ c:\Temp> c:\Python35\python - m venv my_env
7068
7169 Unless you have the Python executable in your path, in which case this:
7270
7371 .. code-block :: posh
74-
75- c:\Temp> python - m venv myenv
7672
73+ c:\Temp> python - m venv my_env
74+
75+ .. note :: Your Python 3 executable may be ``python3``, please substitute
76+ that if required
77+
78+ Depending on how you installed Python (and on your operating system) you
79+ may also have a ``pyvenv `` command available in your PATH. You can use it like so:
80+
81+ .. code-block :: bash
82+
83+ $ pyvenv my_env
7784
7885 .. nextslide ::
7986
8087In any of these command forms, the name of the new virtual environment
81- (``myenv ``) is arbitrary.
88+ (``my_env ``) is arbitrary.
8289
8390.. rst-class :: build
8491.. container ::
@@ -89,13 +96,17 @@ In any of these command forms, the name of the new virtual environment
8996 I also suggest that you keep your virtual environments *in the same
9097 directory * as the project code you are writing.
9198
99+ Be aware that ``venv `` can be sensitive to path names that contain spaces.
100+ Please make sure that the entire path to your working directory does not
101+ contain any spaces just to be safe.
102+
92103.. nextslide ::
93104
94105Let's make one for demonstration purposes:
95106
96107.. code-block :: bash
97108
98- $ pyvenv demoenv
109+ $ python -m venv demoenv
99110 $ ls demoenv
100111 bin include lib pyvenv.cfg
101112
@@ -126,7 +137,7 @@ Every virtual environment you create contains an executable Python command.
126137 terminal, you'll see that it is not the one:
127138
128139 .. container ::
129-
140+
130141 .. code-block :: bash
131142
132143 $ which python
@@ -135,7 +146,7 @@ Every virtual environment you create contains an executable Python command.
135146 in powershell:
136147
137148 .. code-block :: posh
138-
149+
139150 $ gcm python
140151 ...
141152
0 commit comments