invirtualenv.virtualenv module¶
Functions for creating and managing python virtual environments
-
invirtualenv.virtualenv.
build_virtualenv
(name, directory, python_interpreter=None, user=None, verbose=False)¶ Build a virtualenv in a directory
Parameters: - name (str) – Name of the virtualenv to create
- directory (str) – Directory to create the virtualenv in
- python_interpreter (str, optional) – Python interpreter to provide in the virtualenv, defaults to the interpreter that is running the virtualenv command
- verbose (bool) – If True, provides status output while running.
Returns: Full path to the root of the virtualenv directory
Return type: Raises: BuildException
– The Virtualenv build failed
-
invirtualenv.virtualenv.
default_virtualenv_directory
()¶ Get the default virtualenv directory for the current system/platform
Returns: The path to the default virtualenv directory Return type: str
-
invirtualenv.virtualenv.
install_requirements
(requirements, virtualenv, user=None, upgrade=False, verbose=False, pip_version=None, use_index=True, use_local_wheels=False)¶ Open one or more requirements files and run pip -r to install them
Parameters: - requirements (str) – Filename containing requirements
- virtualenv (str) – Full path to the virtualenv to install into
- user (str, optional) – The user:group to run the install as
- upgrade (bool) – If True, tell pip to upgrade when running the install. Default=False
- verbose (bool) – If True, provides status output while running.
- pip_version (str, optional) – Install the requirements with the specified version of pip
- use_index (bool, optional) – Allow pip to use an external index Default=True
- use_local_wheels (bool, optional) – Install wheels from local directory Default=False
-
invirtualenv.virtualenv.
remove_virtualenv
(name, directory=None)¶ Remove a virtualenv from a directory :param name: :param directory: :return:
-
invirtualenv.virtualenv.
upgrade_package_tools
(virtualenv_directory, verbose=False)¶ Upgrade the packages used to install/build packages in the virtualenv :param virtualenv_directory: The directory that contains the virtualenv :type virtualenv_directory: str