- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试使用以下命令在我的笔记本电脑(Ubuntu 12.04)上安装 RNetCDF 软件包
install.packages('RNetCDF',lib='/home/my_computer/RSCRIPTS/R_LIB/',configure.args="--with-netcdf-include='/home/my_computer/bin/libs4cdo-0.0.10/netcdf-4.2/include/' --with-netcdf-lib='/home/my_computer/local/bin' --with-hdf5-lib='/home/my_computer/local/lib/' --with-udunits-include='/usr/local/lib/' --with-udunits-lib='/usr/local/lib/'",repos='http://star-www.st-andrews.ac.uk/cran/')
但该软件包无法安装。请参阅下面的消息:
trying URL 'http://star-www.st-andrews.ac.uk/cran/src/contrib/RNetCDF_1.6.1-2.tar.gz'
Content type 'application/x-gzip' length 70301 bytes (68 Kb)
opened URL
==================================================
downloaded 68 Kb
* installing *source* package ‘RNetCDF’ ...
** package ‘RNetCDF’ successfully unpacked and MD5 sums checked
checking for gcc... gcc -std=gnu99
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc -std=gnu99 accepts -g... yes
checking for gcc -std=gnu99 option to accept ISO C89... none needed
checking for nc_open in -lnetcdf... yes
checking for utInit in -ludunits2... no
checking for utScan in -ludunits2... yes
checking how to run the C preprocessor... gcc -std=gnu99 -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking netcdf.h usability... yes
checking netcdf.h presence... yes
checking for netcdf.h... yes
checking udunits.h usability... yes
checking udunits.h presence... yes
checking for udunits.h... yes
configure: creating ./config.status
config.status: creating R/load.R
config.status: creating src/Makevars
** libs
gcc -std=gnu99 -I/usr/share/R/include -I/usr/local/lib/ -I/home/bauduinm/bin/libs4cdo-0.0.10/netcdf-4.2/include/ -fpic -O3 -pipe -g -c RNetCDF.c -o RNetCDF.o
gcc -std=gnu99 -shared -o RNetCDF.so RNetCDF.o -ludunits2 -lnetcdf -L/home/my_computer/local/lib/ -L/usr/local/lib/ -L/home/my_computer/local/bin -lexpat -L/usr/lib/R/lib -lR
installing to /home/my_computer/RSCRIPTS/R_LIB/RNetCDF/libs
** R
** preparing package for lazy loading
** help
*** installing help indices
** building package indices ...
** testing if installed package can be loaded
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/home/my_computer/RSCRIPTS/R_LIB/RNetCDF /libs/RNetCDF.so':
libexpat.so.0: cannot open shared object file: No such file or directory
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/home/my_computer/RSCRIPTS/R_LIB/RNetCDF’
The downloaded packages are in
‘/tmp/Rtmpl5MniY/downloaded_packages’
Warning message:
In install.packages("RNetCDF", lib = "/home/my_computer/RSCRIPTS/R_LIB/", :
installation of package ‘RNetCDF’ had non-zero exit status
当我尝试使用时
sudo R CMD INSTALL --libary='/home/my_computer/RSCRIPTS/R_LIB/' --configure-args="--with-netcdf-include='/home/my_computer/bin/libs4cdo-0.0.10/netcdf-4.2/include/' --with-netcdf-lib='/home/my_computer/local/lib/' --with-hdf5-lib='/home/my_computer/local/lib/' --with-udunits-include=/usr/local/lib/ --with-udunits-lib=/usr/local/lib/" /home/my_computer/Downloads/RNetCDF_1.6.1-2.tar.gz
错误消息被替换为
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/usr/local/lib/R/site-library/RNetCDF/libs/RNetCDF.so':
libnetcdf.so.7: cannot open shared object file: No such file or directory
libnetcdf.so.7 肯定位于 /home/my_computer/local/lib/
中,这也是我的LD_LIBRARY_PATH
。不可否认,libexpat.so.0 是第一条错误消息中的文件之一(带有 install.packages
),位于与 intel 相关的文件夹中,这些文件夹看起来没有任何内容使用 netcdf 库进行操作。
谁能帮我解答一下吗?
谢谢。
编辑:嗯,我永远不会知道发生了什么,因为当我 3 天后使用完全相同的 install.packages
命令行再次尝试时,软件包安装没有任何问题......所以我的对可能遇到同样问题的人的唯一建议是注销 R 并重新开始,以防 session 中以前的一些错误保留在日志中。
最佳答案
尝试添加--no-test-load
至R CMD INSTALL
这将避免安装过程中出现错误。
然后检查是否可以在正常的 R session 中加载该包(使用 library(RNetCDF)
)。如果由于“无法加载共享对象”错误而失败:
Sys.getenv("LD_LIBRARY_PATH")
ldd /usr/local/lib/R/site-library/RNetCDF/libs/RNetCDF.so
的输出并查看 libnetcdf.so.7 是否解析为 R 的 LD_LIBRARY_PATH 中包含的路径顺便说一句,我使用 Ubuntu 附带的 libnetcdf 安装 RNetCDF 没有任何问题(apt-get install libnetcdf-dev [版本 4.1.1]);除非您确实需要 4.2 版的 libnetcdf,否则您可能想尝试一下。
关于RNetCDF 无法打开共享对象文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16487113/
我正在尝试使用以下命令在我的笔记本电脑(Ubuntu 12.04)上安装 RNetCDF 软件包 install.packages('RNetCDF',lib='/home/my_computer/R
我在使用 RNetCDF 从 NetCDF 数据文件中提取数据时遇到问题。每个数据文件都有 3 个维度(经度、纬度和日期)和 3 个变量(纬度、经度和气候变量)。有四个数据集,每个数据集都有不同的气候
我是一名优秀的程序员,十分优秀!