17db96d56Sopenharmony_ciCreation of :ref:`virtual environments <venv-def>` is done by executing the
27db96d56Sopenharmony_cicommand ``venv``::
37db96d56Sopenharmony_ci
47db96d56Sopenharmony_ci    python -m venv /path/to/new/virtual/environment
57db96d56Sopenharmony_ci
67db96d56Sopenharmony_ciRunning this command creates the target directory (creating any parent
77db96d56Sopenharmony_cidirectories that don't exist already) and places a ``pyvenv.cfg`` file in it
87db96d56Sopenharmony_ciwith a ``home`` key pointing to the Python installation from which the command
97db96d56Sopenharmony_ciwas run (a common name for the target directory is ``.venv``).  It also creates
107db96d56Sopenharmony_cia ``bin`` (or ``Scripts`` on Windows) subdirectory containing a copy/symlink
117db96d56Sopenharmony_ciof the Python binary/binaries (as appropriate for the platform or arguments
127db96d56Sopenharmony_ciused at environment creation time). It also creates an (initially empty)
137db96d56Sopenharmony_ci``lib/pythonX.Y/site-packages`` subdirectory (on Windows, this is
147db96d56Sopenharmony_ci``Lib\site-packages``). If an existing directory is specified, it will be
157db96d56Sopenharmony_cire-used.
167db96d56Sopenharmony_ci
177db96d56Sopenharmony_ci.. deprecated:: 3.6
187db96d56Sopenharmony_ci   ``pyvenv`` was the recommended tool for creating virtual environments for
197db96d56Sopenharmony_ci   Python 3.3 and 3.4, and is
207db96d56Sopenharmony_ci   :ref:`deprecated in Python 3.6 <whatsnew36-venv>`.
217db96d56Sopenharmony_ci
227db96d56Sopenharmony_ci.. versionchanged:: 3.5
237db96d56Sopenharmony_ci   The use of ``venv`` is now recommended for creating virtual environments.
247db96d56Sopenharmony_ci
257db96d56Sopenharmony_ci.. highlight:: none
267db96d56Sopenharmony_ci
277db96d56Sopenharmony_ciOn Windows, invoke the ``venv`` command as follows::
287db96d56Sopenharmony_ci
297db96d56Sopenharmony_ci    c:\>c:\Python35\python -m venv c:\path\to\myenv
307db96d56Sopenharmony_ci
317db96d56Sopenharmony_ciAlternatively, if you configured the ``PATH`` and ``PATHEXT`` variables for
327db96d56Sopenharmony_ciyour :ref:`Python installation <using-on-windows>`::
337db96d56Sopenharmony_ci
347db96d56Sopenharmony_ci    c:\>python -m venv c:\path\to\myenv
357db96d56Sopenharmony_ci
367db96d56Sopenharmony_ciThe command, if run with ``-h``, will show the available options::
377db96d56Sopenharmony_ci
387db96d56Sopenharmony_ci    usage: venv [-h] [--system-site-packages] [--symlinks | --copies] [--clear]
397db96d56Sopenharmony_ci                [--upgrade] [--without-pip] [--prompt PROMPT] [--upgrade-deps]
407db96d56Sopenharmony_ci                ENV_DIR [ENV_DIR ...]
417db96d56Sopenharmony_ci
427db96d56Sopenharmony_ci    Creates virtual Python environments in one or more target directories.
437db96d56Sopenharmony_ci
447db96d56Sopenharmony_ci    positional arguments:
457db96d56Sopenharmony_ci      ENV_DIR               A directory to create the environment in.
467db96d56Sopenharmony_ci
477db96d56Sopenharmony_ci    optional arguments:
487db96d56Sopenharmony_ci      -h, --help            show this help message and exit
497db96d56Sopenharmony_ci      --system-site-packages
507db96d56Sopenharmony_ci                            Give the virtual environment access to the system
517db96d56Sopenharmony_ci                            site-packages dir.
527db96d56Sopenharmony_ci      --symlinks            Try to use symlinks rather than copies, when symlinks
537db96d56Sopenharmony_ci                            are not the default for the platform.
547db96d56Sopenharmony_ci      --copies              Try to use copies rather than symlinks, even when
557db96d56Sopenharmony_ci                            symlinks are the default for the platform.
567db96d56Sopenharmony_ci      --clear               Delete the contents of the environment directory if it
577db96d56Sopenharmony_ci                            already exists, before environment creation.
587db96d56Sopenharmony_ci      --upgrade             Upgrade the environment directory to use this version
597db96d56Sopenharmony_ci                            of Python, assuming Python has been upgraded in-place.
607db96d56Sopenharmony_ci      --without-pip         Skips installing or upgrading pip in the virtual
617db96d56Sopenharmony_ci                            environment (pip is bootstrapped by default)
627db96d56Sopenharmony_ci      --prompt PROMPT       Provides an alternative prompt prefix for this
637db96d56Sopenharmony_ci                            environment.
647db96d56Sopenharmony_ci      --upgrade-deps        Upgrade core dependencies: pip setuptools to the
657db96d56Sopenharmony_ci                            latest version in PyPI
667db96d56Sopenharmony_ci
677db96d56Sopenharmony_ci    Once an environment has been created, you may wish to activate it, e.g. by
687db96d56Sopenharmony_ci    sourcing an activate script in its bin directory.
697db96d56Sopenharmony_ci
707db96d56Sopenharmony_ci.. versionchanged:: 3.9
717db96d56Sopenharmony_ci   Add ``--upgrade-deps`` option to upgrade pip + setuptools to the latest on PyPI
727db96d56Sopenharmony_ci
737db96d56Sopenharmony_ci.. versionchanged:: 3.4
747db96d56Sopenharmony_ci   Installs pip by default, added the ``--without-pip``  and ``--copies``
757db96d56Sopenharmony_ci   options
767db96d56Sopenharmony_ci
777db96d56Sopenharmony_ci.. versionchanged:: 3.4
787db96d56Sopenharmony_ci   In earlier versions, if the target directory already existed, an error was
797db96d56Sopenharmony_ci   raised, unless the ``--clear`` or ``--upgrade`` option was provided.
807db96d56Sopenharmony_ci
817db96d56Sopenharmony_ci.. note::
827db96d56Sopenharmony_ci   While symlinks are supported on Windows, they are not recommended. Of
837db96d56Sopenharmony_ci   particular note is that double-clicking ``python.exe`` in File Explorer
847db96d56Sopenharmony_ci   will resolve the symlink eagerly and ignore the virtual environment.
857db96d56Sopenharmony_ci
867db96d56Sopenharmony_ci.. note::
877db96d56Sopenharmony_ci   On Microsoft Windows, it may be required to enable the ``Activate.ps1``
887db96d56Sopenharmony_ci   script by setting the execution policy for the user. You can do this by
897db96d56Sopenharmony_ci   issuing the following PowerShell command:
907db96d56Sopenharmony_ci
917db96d56Sopenharmony_ci   PS C:\> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
927db96d56Sopenharmony_ci
937db96d56Sopenharmony_ci   See `About Execution Policies
947db96d56Sopenharmony_ci   <https://go.microsoft.com/fwlink/?LinkID=135170>`_
957db96d56Sopenharmony_ci   for more information.
967db96d56Sopenharmony_ci
977db96d56Sopenharmony_ciThe created ``pyvenv.cfg`` file also includes the
987db96d56Sopenharmony_ci``include-system-site-packages`` key, set to ``true`` if ``venv`` is
997db96d56Sopenharmony_cirun with the ``--system-site-packages`` option, ``false`` otherwise.
1007db96d56Sopenharmony_ci
1017db96d56Sopenharmony_ciUnless the ``--without-pip`` option is given, :mod:`ensurepip` will be
1027db96d56Sopenharmony_ciinvoked to bootstrap ``pip`` into the virtual environment.
1037db96d56Sopenharmony_ci
1047db96d56Sopenharmony_ciMultiple paths can be given to ``venv``, in which case an identical virtual
1057db96d56Sopenharmony_cienvironment will be created, according to the given options, at each provided
1067db96d56Sopenharmony_cipath.
1077db96d56Sopenharmony_ci
108