为R3.3安装udunits2软件包

时间:2017-02-17 00:14:35

标签: r

我只是浪费了一整天试图找出如何安装udunits2软件包以便能够安装单元软件包以便能够安装ggforce和ggraph软件包。

我正在尝试在Ubuntu 16.04上安装它,而R> = 3.3因为ggforce是在R 3.3下构建的。

我在这里按照这些说明操作: https://github.com/edzer/units/issues/1

虽然我的机器上安装了libudunits-2.0和udunits(因为sudo apt-get install udunits2找不到udunits2包),而且我的$ PATH上的libudunits-2和udunits位置的PATH在R中当我尝试安装udunits2,units或ggforce时,我收到的错误是

--* installing *source* package ‘udunits2’ ...
** package ‘udunits2’ successfully unpacked and MD5 sums checked
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for XML_ParserCreate in -lexpat... yes
checking how to run the C preprocessor... gcc -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 udunits2.h usability... no
checking udunits2.h presence... no
checking for udunits2.h... no
checking for ut_read_xml in -ludunits2... no
-----Error: libudunits2.a not found-----
     If the udunits2 library is installed in a non-standard location,
     use --configure-args='--with-udunits2-lib=/usr/local/lib' for   
     example,
     or --configure-args='--with-udunits2-include=/usr/include/udunits2'
     replacing paths with appropriate values for your installation.
     You can alternatively use the UDUNITS2_INCLUDE and UDUNITS2_LIB
     environment variables.
     If udunits2 is not installed, please install it.
     It is required for this package.
     ERROR: configuration failed for package ‘udunits2’
* removing ‘/home/fjay/R/x86_64-pc-linux-gnu-library/3.3/udunits2’
* restoring previous ‘/home/fjay/R/x86_64-pc-linux-gnu-library 
/3.3/udunits2’

The downloaded source packages are in
    ‘/tmp/Rtmp0syxnJ/downloaded_packages’
Warning message:
In install.packages("udunits2", lib = "/home/fjay/R/x86_64-pc-linux-
 gnu-library/3.3") :
 installation of package ‘udunits2’ had non-zero exit status
>

所以,嗯,它正在寻找udunits2.h和libudunits2.a文件.... 所以,我从CRAN下载了udunits2,将其解压缩并将其放入我的R库中。 然后,如果我把库(udunits2,lib.loc =“我的库目录”)我得到一个错误,说它没有安装。所以,当我install.package('udunits2',repo = NULL,libconfig.args =' - with-udunits2-lib = / home / fjay / R / x86_64-pc-linux-gnu-library / 3.3')或install.packages('units',....)或install.packages('ggforce',...)它仍在寻找这些文件......并且,在检查了udunits2包之后,这些文件都没有udunits2文件夹。

如果有人知道如何安装这个udunits2套餐,请帮助我!

2 个答案:

答案 0 :(得分:9)

我已经在Linux平台(redhat)上的R中安装了udunits2软件包而没有Internet连接。

我也有这个问题。

首先,我在(udunits2)的Linux示例中安装了/usr/include/udunits2(不是R包udunits2)。

其次,运行此命令有效: install.packages("udunits2_0.13.tar.gz",configure.args='--with-udunits2-include=/usr/include/udunits2')

我希望这段经历可以帮到你。

答案 1 :(得分:2)

这对问这个问题的家伙没有任何帮助,但是我在没有root用户访问权限的计算集群上遇到了同样的问题,并且以下工作正常:

import csv
coord = []
with open('C:/Users/Mert/Desktop/py/transformation/1.csv', 'r') as f:
    reader = csv.reader(f)
    for row in reader:
        rowlist = row.split(',')
        coord.append(rowlist[1:3])
print(coord)