gpt4 book ai didi

python - 在 docker 镜像中安装 R

转载 作者:太空宇宙 更新时间:2023-11-03 15:53:16 24 4
gpt4 key购买 nike

如何在我的 docker 镜像中安装 R 版本 3.4.0。我使用以下方法安装了 python:

RUN yum -y install https://centos6.iuscommunity.org/ius-release.rpm \
&& yum -y install python36u \
&& yum -y install python36u-devel \
&& yum -y install python36u-pip \
&& yum -y install python36u-tkinter.x86_64

同样我需要安装R:

到目前为止,我已经在文件中为 R 指定了以下内容:

ENV R_BASE_VERSION 3.4.0
RUN Rscript -e 'install.packages("devtools",dependencies=TRUE)' \
&&Rscript -e 'install.packages("methods",dependencies=TRUE)' \
&&Rscript -e 'install.packages("jsonlite",dependencies=TRUE)' \

请建议。我是 docker 新手

我想我需要做如下的事情:

ENV R_BASE_VERSION 3.4.1

## Now install R and littler, and create a link for littler in /usr/local/bin
## Also set a default CRAN repo, and make sure littler knows about it too
RUN apt-get update \
&& apt-get install -t unstable -y --no-install-recommends \
littler \
r-cran-littler \
r-base=${R_BASE_VERSION}* \
r-base-dev=${R_BASE_VERSION}* \
r-recommended=${R_BASE_VERSION}* \
&& echo 'options(repos = c(CRAN = "https://cran.rstudio.com/"), download.file.method = "libcurl")' >> /etc/R/Rprofile.site \
&& echo 'source("/etc/R/Rprofile.site")' >> /etc/littler.r \
&& ln -s /usr/share/doc/littler/examples/install.r /usr/local/bin/install.r \
&& ln -s /usr/share/doc/littler/examples/install2.r /usr/local/bin/install2.r \
&& ln -s /usr/share/doc/littler/examples/installGithub.r /usr/local/bin/installGithub.r \
&& ln -s /usr/share/doc/littler/examples/testInstalled.r /usr/local/bin/testInstalled.r \
&& install.r docopt \
&& rm -rf /tmp/downloaded_packages/ /tmp/*.rds \
&& rm -rf /var/lib/apt/lists/*

但我不知道这垃圾是什么。我只需要安装 R,然后我将按照上面指定的方式安装所需的软件包。

编辑:我的 docker 文件中的第一行安装 node4。

最佳答案

这里有两个DockerFile用来安装Python、R和NodeJS

第一个安装 Python 3.4.2、R 3.1.1 和 nodejs 4.8.4:

From node:4
RUN apt-get update && apt-get remove -y python && apt-get install -y python3 r-base
RUN cp /usr/bin/python3 /usr/bin/python

第二个安装 Python 3.5.3、R 3.4.1 和 nodejs 4.8.4:

From r-base:3.4.1
RUN apt-get update && apt-get install -y python3 nodejs
RUN cp /usr/bin/python3 /usr/bin/python

选择最符合您需求的一项。

关于python - 在 docker 镜像中安装 R,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45244387/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com