Dear Rstudio Community,
I am an R user learning Python. I have RStudio on a Windows 10 64 bit laptop.
I wrote a simple .Rmd file with R and Python chunks in it ( see below)
When I “run” it by using Run -> Run All in Rstudio interface, it runs fine ad produces the expected output in console.
When I try to “Knit” it (also from Rstudio interface), I get this error:
Quitting from lines 23-29 (try_python_in_Rstudio.Rmd)
Error in initialize_python(required_module, use_environment) :
Your current architecture is 64bit however this version of Python is compiled for 32bit.
Calls: <Anonymous> ... eng_python_initialize -> ensure_python_initialized -> initialize_python
Execution halted
I am not sure if this is an Rstudio or Knit (or Python) issue. If it is not an issue for this community, I humbly apologize and would appreciate a pointer to where it is best to ask this question.
---
title: "try_python_in_Rstudio"
output: html_document
editor_options:
chunk_output_type: console
---
## R chunk
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
cat("hello world from an R chunk")
x_in_R = 10
```
## Python chunk
```{python}
x_in_python = 15
print("hello world from a python chunk" , x_in_python)
print(x_in_python)
```
## Can I pass a value from R to python?
```{python python_chunk_2}
print("hello world from a python chunk named python_chunk_2")
print(x_in_R)
x_in_R_and_x_in_python = x_in_R + x_in_python
print(x_in_R_and_x_in_python)
```
## Can I pass a value from python to R?
```{r r_chunk_2}
twice_x_in_R_and_x_in_python = 2 * ( x_in_R + x_in_python)
cat(paste("hello world from r_chunk_2. twice_x_in_R_and_x_in_python =", twice_x_in_R_and_x_in_python))
```