By default, Blogdown uses the system Python installation. To tell Blogdown to use a different version of Python, e.g., Python 3 installed via Homebrew, one needs to configure a different engine in Knitr: knitr::opts_chunk$set(engine.path = list(python = '/usr/local/bin/python3')) I include this line in my ~/.Rprofile. Now you can test to ensure that it is using the specified version of Python: import sys print(sys.version) ## 3.9.5 (default, May 4 2021, 03:36:27) ## [Clang 12.

Continue reading

One way to include Matplotlib plots in Rmarkdown files within Blogdown is to save them to the /static directory. Files in this directory are then copied over to the /public directory for publishing. pwd mkdir -p ../../static/post/2017-10-28-using-python-s-matplotlib-with-rmarkdown_files # The p flag will create the directory (and intermediate subdirectories) if it doesn't exist, otherwise will do nothing ## /Users/zac/git/zacbook.net/content/post knitr::current_input() # will return the name of the Rmd file ## [1] "2017-10-28-using-python-s-matplotlib-with-rmarkdown.

Continue reading

Author's picture

Zac Harmany


Sacramento, CA