unable to start device PNG
1、问题
unable to start device PNG
2、排查,进入R,输入:capabilities()
3、测试
> png("a.png") Error in .External2(C_X11, paste0("png::", filename), g$width, g$height, : unable to start device PNG In addition: Warning message: In png("a.png") : unable to open connection to X11 display '' > jpeg("a.jpeg") Error in .External2(C_X11, paste0("jpeg::", quality, ":", filename), g$width, : unable to start device JPEG In addition: Warning message: In jpeg("a.jpeg") : unable to open connection to X11 display '' > bmp("a.bmp") Error in .External2(C_X11, paste0("bmp::", filename), g$width, g$height, : unable to start device BMP In addition: Warning message: In bmp("a.bmp") : unable to open connection to X11 display ''
4、退出R,执行如下命令:
[root@centos7 test2]# yum install libpng-devel libtiff-devel libjpeg-turbo-devel pango-devel libpng-devel -y
5、回到R编译安装目录
[root@centos7 test2]# cd /home/software/R-4.1.3/ [root@centos7 R-4.1.3]# ls bin etc Makefile README ChangeLog include Makefile.fw share config.log INSTALL Makefile.in src config.site lib Makefrag.cc stamp-java config.status library Makefrag.cc_lo SVN-REVISION configure libtool Makefrag.cxx tests configure.ac m4 Makefrag.m tools COPYING Makeconf modules VERSION doc Makeconf.in po VERSION-NICK
6、卸载R
[root@centos7 R-4.1.3]# make uninstall
7、重新编译安装
[root@centos7 R-4.1.3]# ./configure
[root@centos7 R-4.1.3]# make [root@centos7 R-4.1.3]# make install
8、进入R,进行测试
> png("a.png") > jpeg("a.jpeg")
没有问题。