我正在尝试安装一个名为“ncdf 4”的R包。我已经尝试在R-studio界面的“packages”部分安装它,但也尝试在控制台中输入install.packages("ncdf4")
。
这是我在两个示例中得到的输出:
Installing package into ‘/home/user/R/x86_64-pc-linux-gnu-library/3.6’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/ncdf4_1.17.tar.gz'
Content type 'application/x-gzip' length 124458 bytes (121 KB)
==================================================
downloaded 121 KB
* installing *source* package ‘ncdf4’ ...
** package ‘ncdf4’ successfully unpacked and MD5 sums checked
** using staged installation
configure.ac: starting
checking for nc-config... no
-----------------------------------------------------------------------------------
Error, nc-config not found or not executable. This is a script that comes with the
netcdf library, version 4.1-beta2 or later, and must be present for configuration
to succeed.
If you installed the netcdf library (and nc-config) in a standard location, nc-config
should be found automatically. Otherwise, you can specify the full path and name of
the nc-config script by passing the --with-nc-config=/full/path/nc-config argument
flag to the configure script. For example:
./configure --with-nc-config=/sw/dist/netcdf4/bin/nc-config
Special note for R users:
-------------------------
To pass the configure flag to R, use something like this:
R CMD INSTALL --configure-args="--with-nc-config=/home/joe/bin/nc-config" ncdf4
where you should replace /home/joe/bin etc. with the location where you have
installed the nc-config script that came with the netcdf 4 distribution.
-----------------------------------------------------------------------------------
ERROR: configuration failed for package ‘ncdf4’
* removing ‘/home/user/R/x86_64-pc-linux-gnu-library/3.6/ncdf4’
Warning in install.packages :
installation of package ‘ncdf4’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpXcbO2y/downloaded_packages’
有人能从我提供的代码中破译出错误吗?谢谢。
5条答案
按热度按时间nszi6y051#
我用的是Ubuntu 20.4,也遇到了同样的问题。
1.在航站楼
第二步:在航站楼
步骤3:在RStudio中
在此之后,ncdf4安装成功。
参考:https://zoomadmin.com/HowToInstall/UbuntuPackage/libnetcdf-dev
rqqzpn5f2#
我终于安装了ncdf4。
我在这里看到一个类似的问题:https://r.789695.n4.nabble.com/Problem-installing-ncdf-library-td4646986.html
我在linux终端中安装了所有的 libnetcdf 包,方法是输入:
sudo apt install libnetcdf-*
bkkx9g8r3#
如果您运行的是Ubuntu 18.04或其衍生版本,您可以通过执行以下操作来查找
netcdf4.1
库:在我的会话(Linux Mint)中,我得到:
所以,安装
libnetcdf-c++4-1
应该可以解决您的问题:回答你的问题了吗?
eblbsuwk4#
对于Arch Linux用户,您可能还没有安装
netcdf
。您可以使用pacman
安装netcdf
ux6nzvsh5#
通过apt安装netcdf
它为我工作(ubuntu20.04和R4)