See :mod:`venv` for an example of a package with a minimal ``__main__.py``
in the standard library. It doesn't contain a ``if __name__ == '__main__'``
- block. You can invoke it with ``python3 -m venv [directory]``.
+ block. You can invoke it with ``python -m venv [directory]``.
See :mod:`runpy` for more details on the :option:`-m` flag to the
interpreter executable.
.. code-block:: shell-session
- $ python3 -m venv example
+ $ python -m venv example
$ source example/bin/activate
(example) $ python -m pip install wheel
:file:`pdb.py` can also be invoked as a script to debug other scripts. For
example::
- python3 -m pdb myscript.py
+ python -m pdb myscript.py
When invoked as a script, pdb will automatically enter post-mortem debugging if
the program being debugged exits abnormally. After post-mortem debugging (or
.. versionadded:: 3.7
:file:`pdb.py` now accepts a ``-m`` option that execute modules similar to the way
- ``python3 -m`` does. As with a script, the debugger will pause execution just
+ ``python -m`` does. As with a script, the debugger will pause execution just
before the first line of the module.
To create a virtual environment, decide upon a directory where you want to
place it, and run the :mod:`venv` module as a script with the directory path::
- python3 -m venv tutorial-env
+ python -m venv tutorial-env
This will create the ``tutorial-env`` directory if it doesn't exist,
and also create directories inside it containing a copy of the Python
Creation of :ref:`virtual environments <venv-def>` is done by executing the
command ``venv``::
- python3 -m venv /path/to/new/virtual/environment
+ python -m venv /path/to/new/virtual/environment
Running this command creates the target directory (creating any parent
directories that don't exist already) and places a ``pyvenv.cfg`` file in it