首页 > 解决方案 > 在 R-studio 上安装 tseries

问题描述

我正在尝试tseriesR-studio上使用该软件包。

运行代码的导入行我得到一个错误:

> library(tseries)
Error in library(tseries) : there is no package called ‘tseries’

我尝试安装相关包,我得到以下输出。

> install.packages("tseries", dependencies = TRUE)
Installing package into ‘/home/roberto/R/x86_64-pc-linux-gnu-library/3.6’
(as ‘lib’ is unspecified)
also installing the dependencies ‘TTR’, ‘curl’, ‘quantmod’

trying URL 'https://cloud.r-project.org/src/contrib/TTR_0.23-6.tar.gz'
Content type 'application/x-gzip' length 309148 bytes (301 KB)
==================================================
downloaded 301 KB

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/quantmod_0.4.17.tar.gz'
Content type 'application/x-gzip' length 152204 bytes (148 KB)
==================================================
downloaded 148 KB

trying URL 'https://cloud.r-project.org/src/contrib/tseries_0.10-47.tar.gz'
Content type 'application/x-gzip' length 164796 bytes (160 KB)
==================================================
downloaded 160 KB

* installing *source* package ‘curl’ ...
** package ‘curl’ successfully unpacked and MD5 sums checked
** using staged installation
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/roberto/R/x86_64-pc-linux-gnu-library/3.6/curl’
Warning in install.packages :
  installation of package ‘curl’ had non-zero exit status
ERROR: dependency ‘curl’ is not available for package ‘TTR’
* removing ‘/home/roberto/R/x86_64-pc-linux-gnu-library/3.6/TTR’
Warning in install.packages :
  installation of package ‘TTR’ had non-zero exit status
ERROR: dependencies ‘TTR’, ‘curl’ are not available for package ‘quantmod’
* removing ‘/home/roberto/R/x86_64-pc-linux-gnu-library/3.6/quantmod’
Warning in install.packages :
  installation of package ‘quantmod’ had non-zero exit status
ERROR: dependency ‘quantmod’ is not available for package ‘tseries’
* removing ‘/home/roberto/R/x86_64-pc-linux-gnu-library/3.6/tseries’
Warning in install.packages :
  installation of package ‘tseries’ had non-zero exit status

The downloaded source packages are in
    ‘/tmp/RtmpUNGZv6/downloaded_packages’

安装不成功,因为尝试再次导入库,我得到了和以前一样的错误。

> library(tseries)
Error in library(tseries) : there is no package called ‘tseries’

我也试过手动安装,curl但还是不行。我究竟做错了什么?如何解决这个问题?

标签: r

解决方案


这里提到了这个问题:

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)

libcurl的电脑上有吗?如果没有,您需要安装它,例如

sudo apt-get install libcurl4-openssl-dev

如果您在 Debian 上,则在您的终端(即不是 R)中;如果您有其他操作系统,请安装其他库,如上所述。


推荐阅读