Using python together with knitr

Yes, indeed, knitr is currently not able to evaluate code stretching over multiple chunks for languages other than R. The solution is not to use knitr but to use pweave instead. The modifications to the source file are minimal:

test.mdw

---
title: "Minimal example"
---

With a print statement.

<<>>=
x = 'Hello, Python World!'
print(x)
@

Without a print statement.

<<>>=
print(x)
@

The end.

And now run:

pweave -f pandoc test.mdw

There is a note on the pweave's website that installation would fail with pip using python3. I had, though, no problems at all, when simply running:

pip install pweave
pip install markdown

Maybe, it is just an old note.