Quick tip: knitr Python Windows setup checklist
One of the nifty things about using R is that you can use it for many different purposes and even other languages!
If you want to use Python in your knitr docs or the newish RStudio R notebook functionality, you might encounter some fiddliness getting all the moving parts running on Windows. This is a quick knitr Python Windows setup checklist to make sure you don’t miss any important steps.
- Install Python
- I like Anaconda as it’s one of the nicest Windows install experiences
- Try to install for everyone
- Add python to your system’s PATH
- Here’s some general Windows instructions
- Here are Windows 10 instructions
- Restart RStudio or open it now
- The restart is because the PATH would likely have been cached so restarting adds the python executable to your RStudio environment
- Create an rmarkdown document or R Notebook
- Use chunks beginning with
{python chunkname}
to execute some code in Python instead of the usual{r chunkname}