我在Docker上安装rstudio服务器。当我想安装包png时,我收到了错误的消息
`* installing *source* package ‘png’ ...
** package ‘png’ successfully unpacked and MD5 sums checked
** libs
gcc -std=gnu99 -I/usr/local/lib/R/include -DNDEBUG -I/usr/local/include
`libpng-config --cflags` -fpic -g -O2 -fstack-protector-strong -Wformat -
Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c read.c -o
read.o
/bin/bash: libpng-config: command not found
read.c:3:17: fatal error: png.h: No such file or directory
#include <png.h>
^
compilation terminated.
/usr/local/lib/R/etc/Makeconf:132: recipe for target 'read.o' failed
make: *** [read.o] Error 1
ERROR: compilation failed for package ‘png’
* removing ‘/usr/local/lib/R/site-library/png’
Warning in install.packages :
installation of package ‘png’ had non-zero exit status`
我想也许我应该安装一个名为libpng-devel的库,但如何在docker下安装它?请你告诉我?如果它是ubuntu或centos我知道apt-get或yum,但在码头下,我很困惑。
答案 0 :(得分:0)
您需要标识Rstudio的运行容器(例如docker ps
),然后使用docker exec -it <container-id>
在该容器中启动bash shell。从外壳程序,您可以安装所需的任何系统软件包。
答案 1 :(得分:0)
添加到上面的prusswan的答案中。使用Windows命令在命令行上首先找到您的容器名称:
docker -ps
这将为您提供图像ID和名称(如果有)。我将使用id打开bash命令行界面:
docker exec -ti d352815fb16b bash
现在,我们将安装所需的png所需的linux库。在bash shell中,输入:
apt-get install libpng-dev
您应该收到确认提示,键入y,它将安装。要退出linux shell,请键入Cntl-D。
现在返回浏览器中的Rocker界面,并尝试再次安装png:
install.packages('png')