如何在 Ubuntu 上将 pdftools 安装到 RStudio?

如何在 Ubuntu 上将 pdftools 安装到 RStudio?

有谁知道如何安装pdftools到在 Ubuntu 18.04.3 LTS 上运行的 RStudio 1.2.5019?我试过:

> install.packages("pdftools")
Installing package into ‘/home/jaakko/R/x86_64-pc-linux-gnu-library/3.4’
(as ‘lib’ is unspecified)
also installing the dependencies ‘curl’, ‘qpdf’

trying URL 'https://cloud.r-project.org/src/contrib/curl_4.3.tar.gz'
Content type 'application/x-gzip' length 673779 bytes (657 KB)
==================================================
downloaded 657 KB

trying URL 'https://cloud.r-project.org/src/contrib/qpdf_1.1.tar.gz'
Content type 'application/x-gzip' length 321408 bytes (313 KB)
==================================================
downloaded 313 KB

trying URL 'https://cloud.r-project.org/src/contrib/pdftools_2.3.tar.gz'
Content type 'application/x-gzip' length 934367 bytes (912 KB)
==================================================
downloaded 912 KB

* installing *source* package ‘curl’ ...
** package ‘curl’ successfully unpacked and MD5 sums checked
Package libcurl was not found in the pkg-config search path.
Perhaps you should add the directory containing `libcurl.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libcurl' found
Package libcurl was not found in the pkg-config search path.
Perhaps you should add the directory containing `libcurl.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libcurl' found
Using PKG_CFLAGS=
Using PKG_LIBS=-lcurl
------------------------- ANTICONF ERROR ---------------------------
Configuration failed because libcurl was not found. Try installing:
 * deb: libcurl4-openssl-dev (Debian, Ubuntu, etc)
 * rpm: libcurl-devel (Fedora, CentOS, RHEL)
 * csw: libcurl_dev (Solaris)
If libcurl is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a libcurl.pc file. If pkg-config
is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
--------------------------------------------------------------------
ERROR: configuration failed for package ‘curl’
* removing ‘/home/jaakko/R/x86_64-pc-linux-gnu-library/3.4/curl’
Warning in install.packages :
  installation of package ‘curl’ had non-zero exit status
ERROR: dependency ‘curl’ is not available for package ‘qpdf’
* removing ‘/home/jaakko/R/x86_64-pc-linux-gnu-library/3.4/qpdf’
Warning in install.packages :
  installation of package ‘qpdf’ had non-zero exit status
ERROR: dependency ‘qpdf’ is not available for package ‘pdftools’
* removing ‘/home/jaakko/R/x86_64-pc-linux-gnu-library/3.4/pdftools’
Warning in install.packages :
  installation of package ‘pdftools’ had non-zero exit status

The downloaded source packages are in
    ‘/tmp/RtmpzEAfLC/downloaded_packages’
> library(pdftools)
Error in library(pdftools) : there is no package called ‘pdftools’

答案1

仔细查看错误消息。如果您想在 Linux 上使用 R 包,有时需要先安装依赖项。这里libcurl4-openssl-dev。从终端使用以下命令来安装此软件包。然后你应该能够pdftools从 R安装。

sudo apt install libcurl4-openssl-dev

相关内容