Class PythonInstaller

Constructors

Methods

  • Checks if a given command exists.

    Parameters

    • cmd: string

      The command name.

    Returns Promise<boolean>

  • Ensures that a Python executable is available. If found on the system, returns its command name. Otherwise, installs Python automatically using pyenv-win (on Windows) or pyenv (on Linux/macOS).

    Parameters

    • version: string = "3.9.1"

      The Python version to ensure (default "3.9.1").

    • pyenvPath: string

      The path to the pyenv executable (example "/usr/local/bin/.pyenv").

    • OptionalvenvPath: string

      Optional path to the virtual environment. This value is optional but could be required if the process is a ElectronJS application or process executable is located in protected folders on OS. So instead of checking the system folders, use non-protected folders for venv folder and check exsistence of the venv folder.

    Returns Promise<string>

    The path to the Python executable.

  • Retrieves the path to the Python executable for a given version installed via pyenv.

    Parameters

    • version: string

    Returns Promise<string>

  • Installs pyenv on Linux/macOS by cloning its repository.

    Parameters

    • pyenvRoot: string

    Returns Promise<void>

  • Installs a specific Python version via pyenv (or pyenv-win on Windows).

    Parameters

    • version: string

    Returns Promise<void>