Skip to main content

WebView2 Installer

Документация на русском

A library for checking and automatically installing the WebView2 Evergreen Runtime on Windows.

Supported architectures: x86, x64, ARM64.

📦 Distribution Methods

1. Python Package (wheel)

pip install webview2-installer

2. DLL Library

Pre-built DLL files for integration into C/C++ projects:

  • webview2_installer_x86.dll — for 32-bit Windows
  • webview2_installer_x64.dll — for 64-bit Windows
  • webview2_installer_arm64.dll — for ARM64 Windows

🚀 Usage in Python

from webview2_installer import (
    is_webview2_installed,
    install_webview2_if_not_installed,
    download_and_install_webview2
)

# Check if WebView2 is installed
if is_webview2_installed():
    print("✅ WebView2 is already installed")
else:
    print("❌ WebView2 not found")

# Install if not installed (recommended method)
result = install_webview2_if_not_installed(verbose=True)
if result == 0:
    print("✅ WebView2 is already installed")
elif result == 1:
    print("✅ WebView2 installation started")
else:
    print("❌ WebView2 installation failed")

# Force download and installation
success = download_and_install_webview2(verbose=True)
if success:
    print("✅ Installation successfully started")

Return values for install_webview2_if_not_installed()

Value Description
0 WebView2 is already installed
1 Installation successfully started
-1 Installation failed

🔧 Using the DLL in C/C++

Function Signatures

// Checks if WebView2 is installed
bool is_webview2_installed(void);

// Downloads and installs WebView2 (silent installation)
bool download_and_install_webview2(void);

// With verbose output
bool download_and_install_webview2_verbose(void);

// Installs if not installed (0 = already installed, 1 = success, -1 = error)
int install_webview2_if_not_installed(void);

// With verbose output
int install_webview2_if_not_installed_verbose(void);

C Example

#include <windows.h>
#include <stdio.h>

typedef bool (*is_installed_fn)(void);
typedef int (*install_if_needed_fn)(void);

int main() {
    HMODULE dll = LoadLibrary("webview2_installer_x64.dll");
    if (!dll) return 1;
    
    is_installed_fn is_installed = (is_installed_fn)GetProcAddress(dll, "is_webview2_installed");
    install_if_needed_fn install_if_needed = (install_if_needed_fn)GetProcAddress(dll, "install_webview2_if_not_installed");
    
    if (is_installed && install_if_needed) {
        int result = install_if_needed();
        printf("Result: %d\n", result);
    }
    
    FreeLibrary(dll);
    return 0;
}

🛠️ Development and Building

Requirements

  • Rust (2021 edition)
  • Python 3.8+
  • Visual Studio Build Tools (Windows)
  • cargo, rustup
  • rcedit

Building the DLL

# Build release versions for all architectures
python build_dll.py

# Build debug versions
python build_dll.py --debug

# Dynamic linking (requires VC++ Redist)
python build_dll.py --dynamic

Building the Python Package

# Install development dependencies
pip install -e ".[dev]"

# Build the package
python -m build

# Or via devscript
devscript build_wheel

Cleaning Build Files

devscript clean

📋 System Requirements

  • OS: Windows 7 / 8 / 10 / 11
  • Architectures: x86, x64, ARM64
  • Python: 3.8+ (for Python package)
  • Internet: required for downloading the installer

🔍 How It Works

  • Installation Check: Checks for WebView2 registry keys in Windows registry
  • Download: Downloads the official Microsoft installer
  • Installation: Runs in silent mode (/silent /install)
  • Cleanup: Temporary files are automatically deleted

📄 License

MIT License

🤝 Contributing

PRs and Issues are welcome! Please ensure changes work on all target architectures.

⚠️ Known Limitations

  • Windows only (target platform)
  • Synchronous installation — you need to wait for WebView2 to finish installing

WebView2 Installer

Documentation in English

Библиотека для проверки установки и автоматической установки WebView2 Evergreen Runtime на Windows.

Поддерживает архитектуры: x86, x64, ARM64.

📦 Способы распространения

1. Python пакет (wheel)

pip install webview2-installer

2. DLL библиотека

Готовые DLL файлы для интеграции в C/C++ проекты:

  • webview2_installer_x86.dll — для 32-bit Windows
  • webview2_installer_x64.dll — для 64-bit Windows
  • webview2_installer_arm64.dll — для ARM64 Windows

🚀 Использование в Python

from webview2_installer import (
    is_webview2_installed,
    install_webview2_if_not_installed,
    download_and_install_webview2
)

# Проверить, установлен ли WebView2
if is_webview2_installed():
    print("✅ WebView2 уже установлен")
else:
    print("❌ WebView2 не найден")

# Установить, если не установлен (рекомендуемый способ)
result = install_webview2_if_not_installed(verbose=True)
if result == 0:
    print("✅ WebView2 уже установлен")
elif result == 1:
    print("✅ Установка WebView2 запущена")
else:
    print("❌ Ошибка установки WebView2")

# Принудительная загрузка и установка
success = download_and_install_webview2(verbose=True)
if success:
    print("✅ Установка успешно запущена")

Возвращаемые значения install_webview2_if_not_installed()

Значение Описание
0 WebView2 уже установлен
1 Установка успешно запущена
-1 Ошибка установки

🔧 Использование DLL в C/C++

Сигнатуры функций

// Проверяет установлен ли WebView2
bool is_webview2_installed(void);

// Загружает и устанавливает WebView2 (тихая установка)
bool download_and_install_webview2(void);

// С подробным выводом
bool download_and_install_webview2_verbose(void);

// Устанавливает если не установлен (0 = уже есть, 1 = успешно, -1 = ошибка)
int install_webview2_if_not_installed(void);

// С подробным выводом
int install_webview2_if_not_installed_verbose(void);

Пример на C

#include <windows.h>
#include <stdio.h>

typedef bool (*is_installed_fn)(void);
typedef int (*install_if_needed_fn)(void);

int main() {
    HMODULE dll = LoadLibrary("webview2_installer_x64.dll");
    if (!dll) return 1;
    
    auto is_installed = (is_installed_fn)GetProcAddress(dll, "is_webview2_installed");
    auto install_if_needed = (install_if_needed_fn)GetProcAddress(dll, "install_webview2_if_not_installed");
    
    if (is_installed && install_if_needed) {
        int result = install_if_needed();
        printf("Result: %d\n", result);
    }
    
    FreeLibrary(dll);
    return 0;
}

🛠️ Разработка и сборка

Требования

  • Rust (2021 edition)
  • Python 3.8+
  • Visual Studio Build Tools (Windows)
  • cargo, rustup
  • rcedit

Сборка DLL

# Собрать release версии для всех архитектур
python build_dll.py

# Собрать debug версии
python build_dll.py --debug

# Динамическая линковка (требуется VC++ Redist)
python build_dll.py --dynamic

Сборка Python пакета

# Установка зависимостей разработки
pip install -e ".[dev]"

# Сборка пакета
python -m build

# Или через devscript
devscript build_wheel

Очистка файлов сборки

devscript clean

📋 Требования к системе

  • ОС: Windows 7 / 8 / 10 / 11
  • Архитектуры: x86, x64, ARM64
  • Python: 3.8+ (для Python пакета)
  • Интернет: требуется для загрузки установщика

🔍 Как это работает

  1. Проверка установки: через реестр Windows проверяется наличие ключей WebView2
  2. Загрузка: скачивается официальный установщик от Microsoft
  3. Установка: запускается в тихом режиме (/silent /install)
  4. Очистка: временные файлы автоматически удаляются

📄 Лицензия

MIT License

🤝 Вклад в проект

PR и Issues приветствуются! Убедитесь, что изменения работают на всех целевых архитектурах.

⚠️ Известные ограничения

  • Только Windows (целевая платформа)
  • Установка синхронная — требуется подождать, пока webview2 установится

Metadata

Release files for webview2-installer 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for webview2-installer 1.0.1
File Size Uploaded
webview2_installer-1.0.1.tar.gz 4.9 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for webview2-installer 1.0.1
File Interpreter ABI Platform
webview2_installer-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 9.9 MB

Release files / webview2_installer-1.0.1.tar.gz

Download URL webview2_installer-1.0.1.tar.gz
Size 4.9 MB
Tags Source
SHA-256 checksum
How to use checksums
e1f6d71afe3e64b59916e33ef399e25daa1f05f312188f76dc947cbc1a2b944d
BLAKE2b-256 checksum
How to use checksums
8fd5718a3ede3b71ee0bf0cbedf438e8c44802eca80ffa5dede7909c2a92c8df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Release files / webview2_installer-1.0.1-py3-none-any.whl

Download URL webview2_installer-1.0.1-py3-none-any.whl
Size 5.0 MB
Tags Python 3
SHA-256 checksum
How to use checksums
fe0d505c7bbb6ab5b14b90dcef35f5f050abc4e3379198250bad0cc2a845a1fe
BLAKE2b-256 checksum
How to use checksums
2dd2bcb3a6901bb8e83f3e0c862047c2265563ad7137f8a299595e30f7190492
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page