Python API#

PETSc’s Python API is provided by the binding petsc4py. To use

  • Configure PETSc with --with-petsc4py and (likely) --download-mpi4py.

  • Ensure the environmental variable PYTHONPATH contains $PETSC_DIR/$PETSC_ARCH/lib

Examples of petsc4py usage may be found in $PETSC_DIR/src/binding/petsc4py/demo