R开罗安装,不带apt-get、sudo

tvz2xvvm  于 2023-02-06  发布在  其他
关注(0)|答案(3)|浏览(208)

我正在一台没有头的ubuntu机器上工作,它已经预装了cairo的大部分需求,但是我在让R使用Cairo时遇到了一些困难。有人知道为了让install.packages正确地构建Cairo,我需要设置/安装哪些标志或额外的包吗?我不能使用sudo命令或apt-get,并且其他软件必须占用〈50 Mb的内存。这可能吗?看起来我需要的几乎所有东西都存在,如果我可以将其连接到R。

> library('Cairo')
Error in library("Cairo") : there is no package called ‘Cairo’
> install.packages('Cairo')
...
* installing *source* package ‘Cairo’ ...
...
checking for pkg-config... /usr/bin/pkg-config
configure: CAIRO_CFLAGS=/usr/lib:/usr/bin:/usr/include
checking if R was compiled with the RConn patch... no
checking cairo.h usability... no
checking cairo.h presence... no
checking for cairo.h... no
configure: error: Cannot find cairo.h! Please install cairo (http://www.cairographics.org/) and/or set CAIRO_CFLAGS/LIBS correspondingly.
ERROR: configuration failed for package ‘Cairo’
* removing ‘/app/vendor/R/lib64/R/library/Cairo’

这意味着我需要安装libcairo 2-dev包,但是通过configure/make安装会遇到pixman错误,尽管我的系统上已经安装了pixman:

package pixman-1 was not found in the pkg-config search path.
Perhaps you should add the directory containing `pixman-1.pc'
to the PKG_CONFIG_PATH environment variable
No package 'pixman-1' found
No package 'pixman-1' found
checking whether cairo's image surface backend feature could be enabled
no (requires pixman-1 >= 0.22.0 http://cairographics.org/releases/)error: mandatory image surface backend feature could not be enabled

安装内容:

$ dpkg -l | grep 'cairo\|png\|fontc\|pix'
ii  fontconfig     2.8.0-2ubuntu1 generic font configuration library - support
ii  fontconfig-con 2.8.0-2ubuntu1 generic font configuration library - configu
ii  libcairo2      1.8.10-2ubuntu The Cairo 2D vector graphics library
ii  libfontconfig1 2.8.0-2ubuntu1 generic font configuration library - runtime
ii  libpixman-1-0  0.16.4-1ubuntu pixel-manipulation library for X and cairo
ii  libpng12-0     1.2.42-1ubuntu PNG library - runtime
ii  libpng12-dev   1.2.42-1ubuntu PNG library - development

我的会话信息:

> sessionInfo()
R version 2.15.1 (2012-06-22)
Platform: x86_64-unknown-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=C                 LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

R看不到开罗:

> capabilities()
    jpeg      png     tiff    tcltk      X11     aqua http/ftp  sockets 
   FALSE    FALSE    FALSE    FALSE    FALSE    FALSE     TRUE     TRUE 
  libxml     fifo   cledit    iconv      NLS  profmem    cairo 
    TRUE     TRUE     TRUE     TRUE     TRUE    FALSE    FALSE
0yycz8jy

0yycz8jy1#

你需要cario开发文件

apt-get install libcairo2-dev

我还需要安装以下内容

apt-get install libxt-dev

对于不使用apt的解决方案(如OP所要求的),请参见以下答案

n6lpvg4x

n6lpvg4x2#

看起来你需要cario-devel。请看下面的安装说明。至少这样做解决了我缺少“cairo.h”的问题。希望这能有所帮助。
http://cairographics.org/download/

lztngnrs

lztngnrs3#

请按照以下步骤操作

sudo apt-get install libcairo2-dev

安装后,您可以在R-Studio中执行以下命令

install.packages('Cairo')
library(Cairo)

相关问题