:orphan:
# PetscPythonInitialize
Initialize Python for use with PETSc and import petsc4py.
## Synopsis
```
#include "petscsys.h"
PetscErrorCode PetscPythonInitialize(const char pyexe[], const char pylib[])
```
## Input Parameters
- ***pyexe -*** path to the Python interpreter executable, or `NULL`.
- ***pylib -*** full path to the Python dynamic library, or `NULL`.
## See Also
`PetscPythonFinalize()`, `PetscPythonPrintError()`
## Level
intermediate
## Location
src/sys/python/pythonsys.c
## Examples
src/ksp/ksp/tutorials/ex100.c
src/ksp/ksp/tutorials/ex100f.F90
---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/sys/python/pythonsys.c)
[Index of all Sys routines](index.md)
[Table of Contents for all manual pages](/manualpages/index.md)
[Index of all manual pages](/manualpages/singleindex.md)