Created
October 26, 2022 15:38
-
-
Save jlomako/b3d273a9fa1f0ac559d221a27a772fea to your computer and use it in GitHub Desktop.
create python environment in R Studio for ML class
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Set up environment for Python in R Studio | |
# install.packages("reticulate") # run only once | |
library(reticulate) | |
# create python environment | |
conda_create(envname = "mlclass", python_version = "3.9") | |
use_condaenv("mlclass") | |
# install packages | |
py_install(packages = c("numpy", "matplotlib", "pandas", "scikit-learn")) | |
# now open python script in R studio and execute commands from there | |
# alternatively run python script from file: | |
source_python("script.py") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment