---
# System prepended metadata

title: R container + python
tags: [產險]

---

# R container + python
###### tags: `產險`


- [Python 浮點數四捨五入，無條件進位，無條件捨去 floats round up and round down](https://matthung0807.blogspot.com/2020/12/python-float-number-round-up-round-down.html)

---

1.install python 3.6
指令
![](https://i.imgur.com/Z6HdsYK.png)


無法安裝
![](https://i.imgur.com/YElHkxq.png)



2. install python3.6 (加上下載來源)
指令
![](https://i.imgur.com/Bxi4UCA.png)

回傳訊息
![](https://i.imgur.com/geP6lUF.png)




3. 將install python3.6改成install python3
![](https://i.imgur.com/2Jn5WmR.png)

回傳訊息
![](https://i.imgur.com/Xxg61ac.png)

安裝成功python3.5
![](https://i.imgur.com/kLCHET3.png)


```dockerfile=
FROM rocker/r-ver:3.4.3

RUN apt-get update \
    && apt-get install -y wget \
    && apt-get install -y libssl-dev \
    && apt-get install -y build-essential \
    && apt-get install -y libcurl4-gnutls-dev \
    && apt-get install -y libxml2-dev \
    && apt-get install -y python3 \
    && apt-get install -y python3-pip

# install R packages
RUN R -e "install.packages('https://cran.r-project.org/src/contrib/Archive/randomForest/randomForest_4.6-12.tar.gz', repo=NULL, type='source')"
RUN R -r "library('randomForest')"

RUN R -e "install.packages('https://cran.r-project.org/src/contrib/Archive/caret/caret_6.0-76.tar.gz', repo=NULL, type='source')"
RUN R -r "library('caret')"

RUN R -e "install.packages('https://cran.r-project.org/src/contrib/Archive/ggplot2/ggplot2_2.2.1.tar.gz', repo=NULL, type='source')"
RUN R -r "library('ggplot2')"

RUN R -e "install.packages('https://cran.r-project.org/src/contrib/Archive/plyr/plyr_1.8.4.tar.gz', repo=NULL, type='source')"
RUN R -r "library('plyr')"

RUN R -e "install.packages('https://cran.r-project.org/src/contrib/Archive/yaml/yaml_2.1.14.tar.gz', repo=NULL, type='source')"
RUN R -r "library('yaml')"

RUN R -e "install.packages('plumber')"
RUN R -r "library('plumber')"

RUN R -e "install.packages('logging')"
RUN R -r "library('logging')"

# make dir	
RUN mkdir -p /src
RUN mkdir -p /src/log

COPY .    /src  
WORKDIR /src

# make all app files readable, gives rwe permisssion (solves issue when dev in Windows, but building in Ubuntu)
RUN chmod -R 755 /src

# Install the python dependencies in /opt/app/requirements.txt using pip
copy requirements.txt /src/
RUN pip3 install -r /src/requirements.txt



EXPOSE 5000

ENTRYPOINT [ "/bin/bash", "gateway_boot.sh" ]
```





![](https://i.imgur.com/OmNCU0i.png)
