Installation

Installatie

Deze pagina installeert Aspose.HTML FOSS voor Python en verifieert de configuratie met een minimale DOM round-trip.


Prerequisites

RequirementDetail
Python3.10 of hoger
pipElke recente versie
BesturingssysteemWindows, Linux of macOS
Native afhankelijkhedenGeen — pure Python implementatie

1. Maak een virtuele omgeving (aanbevolen)

Houd de installatie geïsoleerd van het systeem Python:

python -m venv .venv

Activeer het — op Windows:

.venv\Scripts\activate

Op Linux/macOS:

source .venv/bin/activate

2. Installeer het pakket

Installeer de huidige release (0.1.0) van PyPI:

git clone https://github.com/aspose-html-foss/Aspose.HTML-FOSS-for-Python.git
cd Aspose.HTML-FOSS-for-Python
pip install -e .

3. Verifieer de installatie

Bouw een één-element document en lees een berekende stijl terug — als dit zonder fouten afdrukt, werkt de installatie:

from aspose_html.dom import Document
from aspose_html.cssom import CSSStyleSheet

doc = Document()
el = doc.create_element("div")
el.set_attribute("id", "bar")
doc.append_child(el)

sheet = CSSStyleSheet()
sheet.replace_sync("#bar { color: blue }")
doc.attach_style_sheet(sheet)

print(el.get_computed_style().get_property_value("color"))

Volgende stappen

Zie ook

 Nederlands