Installation

Installation von Aspose.3D FOSS für Python

Aspose.3D FOSS für Python wird als reines Pythons Paket auf PyPI verteilt. es gibt keine native Erweiterungen zu kompilieren, keine Systembibliotheken zu installieren und keine Microsoft Office oder andere Dritte-Laufzeit erforderlich.


Prerequisites

RequirementDetail
Python Version3, 4, 3, 8, 3, 9, 3, 10, 3 oder 3.12
PaketmanagerPip (verbundelt mit CPython)
BetriebssystemWindows, macOS, Linux (alle Plattformen, die CPython betreiben)
Compiler / BauwerkzeugeKein erforderlich
SystempaketeKein erforderlich

1. Installation über Pip (Rekommend)

Der einfachste Weg, um Aspose.3D FOSS zu installieren ist direkt von PyPI:

asposefoss/3d is not yet published — build from source until it ships. See the project README for build instructions.

pip wird das Paket herunterladen und installieren und es in Ihrem Umfeld aufzeichnen. keine Post-Installation ist erforderlich.

Um eine gepflanzte Version für reproduzierbare Bauteile zu installieren:

asposefoss/3d is not yet published — build from source until it ships. See the project README for build instructions.

2. Einrichten eines virtuellen Umfeldes (verabreicht für Projekte)

Mit einer virtuellen Umgebung hält die Bibliothek isoliert von anderen Python-Projekten und vermietet Versionkonflikte.

*** Erstellen und aktivieren Sie eine virtuelle Umgebung::

##Create the environment
python -m venv .venv

##Activate on Linux / macOS
source .venv/bin/activate

##Activate on Windows (Command Prompt)
.venv\Scripts\activate.bat

##Activate on Windows (PowerShell)
.venv\Scripts\Activate.ps1

****Installieren Sie die Bibliothek innerhalb der aktivierten Umgebung::

asposefoss/3d is not yet published — build from source until it ships. See the project README for build instructions.

*** Rekordabhängigkeit für Reproduktion::

pip freeze > requirements.txt

Um die Umwelt auf einer anderen Maschine zu erneuern:

python -m venv .venv
source .venv/bin/activate   # or the Windows equivalent
pip install -r requirements.txt

3. Überprüfen Sie die Installation

Nach der Installation überprüfen Sie, ob die Bibliothek richtig importiert:

from aspose.threed import Scene

scene = Scene()
print("Aspose.3D FOSS installed successfully")
print(f"Root node name: {scene.root_node.name}")

Erwartete Produktion:

Aspose.3D FOSS installed successfully
Root node name:

Hinweis : Der Wurzelnode hat keinen Standardname - scene.root_node.name Eine leere String zurückgibt.

Sie können auch die installierte Version mit Pip überprüfen:

pip show aspose-3d-foss

Hierbei wird die Version, Autor und Lizenz (MIT) gedruckt.


Schnelle Start: Laden Sie eine Szenar und überprüfen Sie sie

Das folgende Script laden eine 3D-Datei herunter, druckt Informationen über jeden Mischknoten und exportiert die Szene in das GLB-Format:

from aspose.threed import Scene
from aspose.threed.formats import ObjLoadOptions

##Load an OBJ file with material support
options = ObjLoadOptions()
options.enable_materials = True
options.flip_coordinate_system = False

scene = Scene()
scene.open("model.obj", options)

##Print the scene hierarchy
print(f"Top-level nodes: {len(scene.root_node.child_nodes)}")

for node in scene.root_node.child_nodes:
    if node.entity is None:
        continue
    mesh = node.entity
    print(f"  Node: {node.name}")
    print(f"    Vertices: {len(mesh.control_points)}")
    print(f"    Polygons: {len(mesh.polygons)}")
    if node.material:
        print(f"    Material: {type(node.material).__name__}")

##Re-export to GLB (binary glTF)
scene.save("output.glb")
print("Saved output.glb")

Wenn Sie noch keine OBJ-Datei haben, kann die Bibliothek auch eine Szenen aus dem Schraub erstellen:

from aspose.threed import Scene

##Create an empty scene and save it as glTF
scene = Scene()
scene.save("empty.gltf")
print("Created empty.gltf")

Plattform Noten

Windows, MacOS und Linux: Die Bibliothek ist auf allen Plattformen identisch.Es gibt keine Plattformspezifischen Code-Paths oder binäre Erweiterungen.

Docker / Serverlos: Da es keine System-Package-Abhängigkeiten gibt, funktioniert die Bibliothek innerhalb schmutziger Docker Bilder (wie: python:3.12-slimohne zusätzliche apt oder yum-Pakete zu installieren.

CI/CD: Add zu pip install aspose-3d-foss auf den Abhängigkeitsschritt Ihres CI-Pipels. keine zusätzliche Einstellung erforderlich ist.

und Conda: Wenn Ihr Projekt Conda verwendet, installieren Sie die Bibliothek von PyPI in einem Condas Umfeld:

conda create -n my-env python=3.12
conda activate my-env
pip install aspose-3d-foss

Zusätzliche Ressourcen

Siehe auch

 Deutsch