class venv.EnvBuilder(system_site_packages=False, clear=False, symlinks=False, upgrade=False, with_pip=False, prompt=None, upgrade_deps=False)  
The EnvBuilder class accepts the following keyword arguments on instantiation:  
system_site_packages – a Boolean value indicating that the system Python site-packages should be available to the environment (defaults to False). 
clear – a Boolean value which, if true, will delete the contents of any existing target directory, before creating the environment. 
symlinks – a Boolean value indicating whether to attempt to symlink the Python binary rather than copying. 
upgrade – a Boolean value which, if true, will upgrade an existing environment with the running Python - for use when that Python has been upgraded in-place (defaults to False). 
with_pip – a Boolean value which, if true, ensures pip is installed in the virtual environment. This uses ensurepip with the --default-pip option. 
prompt – a String to be used after virtual environment is activated (defaults to None which means directory name of the environment would be used). If the special string "." is provided, the basename of the current directory is used as the prompt. 
upgrade_deps – Update the base venv modules to the latest on PyPI   Changed in version 3.4: Added the with_pip parameter   New in version 3.6: Added the prompt parameter   New in version 3.9: Added the upgrade_deps parameter  Creators of third-party virtual environment tools will be free to use the provided EnvBuilder class as a base class. The returned env-builder is an object which has a method, create:  
create(env_dir)  
Create a virtual environment by specifying the target directory (absolute or relative to the current directory) which is to contain the virtual environment. The create method will either create the environment in the specified directory, or raise an appropriate exception. The create method of the EnvBuilder class illustrates the hooks available for subclass customization: def create(self, env_dir):
    """
    Create a virtualized Python environment in a directory.
    env_dir is the target directory to create an environment in.
    """
    env_dir = os.path.abspath(env_dir)
    context = self.ensure_directories(env_dir)
    self.create_configuration(context)
    self.setup_python(context)
    self.setup_scripts(context)
    self.post_setup(context)
 Each of the methods ensure_directories(), create_configuration(), setup_python(), setup_scripts() and post_setup() can be overridden. 
  
ensure_directories(env_dir)  
Creates the environment directory and all necessary directories, and returns a context object. This is just a holder for attributes (such as paths), for use by the other methods. The directories are allowed to exist already, as long as either clear or upgrade were specified to allow operating on an existing environment directory. 
  
create_configuration(context)  
Creates the pyvenv.cfg configuration file in the environment. 
  
setup_python(context)  
Creates a copy or symlink to the Python executable in the environment. On POSIX systems, if a specific executable python3.x was used, symlinks to python and python3 will be created pointing to that executable, unless files with those names already exist. 
  
setup_scripts(context)  
Installs activation scripts appropriate to the platform into the virtual environment. 
  
upgrade_dependencies(context)  
Upgrades the core venv dependency packages (currently pip and setuptools) in the environment. This is done by shelling out to the pip executable in the environment.  New in version 3.9.  
  
post_setup(context)  
A placeholder method which can be overridden in third party implementations to pre-install packages in the virtual environment or perform other post-creation steps. 
  Changed in version 3.7.2: Windows now uses redirector scripts for python[w].exe instead of copying the actual binaries. In 3.7.2 only setup_python() does nothing unless running from a build in the source tree.   Changed in version 3.7.3: Windows copies the redirector scripts as part of setup_python() instead of setup_scripts(). This was not the case in 3.7.2. When using symlinks, the original executables will be linked.  In addition, EnvBuilder provides this utility method that can be called from setup_scripts() or post_setup() in subclasses to assist in installing custom scripts into the virtual environment.  
install_scripts(context, path)  
path is the path to a directory that should contain subdirectories “common”, “posix”, “nt”, each containing scripts destined for the bin directory in the environment. The contents of “common” and the directory corresponding to os.name are copied after some text replacement of placeholders:  
__VENV_DIR__ is replaced with the absolute path of the environment directory. 
__VENV_NAME__ is replaced with the environment name (final path segment of environment directory). 
__VENV_PROMPT__ is replaced with the prompt (the environment name surrounded by parentheses and with a following space) 
__VENV_BIN_NAME__ is replaced with the name of the bin directory (either bin or Scripts). 
__VENV_PYTHON__ is replaced with the absolute path of the environment’s executable.  The directories are allowed to exist (for when an existing environment is being upgraded).