如何在macOS Sierra 10.12.4上安装RODBC [英] how to install RODBC on macOS Sierra 10.12.4

查看:90
本文介绍了如何在macOS Sierra 10.12.4上安装RODBC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在R 3.4.0中,

install.packages('RODBC', type='source')

在macOS 10.12.4上失败.我还从CRAN下载了RODBC_1.3-15.tar.gz并尝试了

fails on macOS 10.12.4. I also downloaded RODBC_1.3-15.tar.gz from CRAN and tried,

R CMD INSTALL RODBC_1.3-15.tar.gz

在两种情况下,我都找不到ODBC标头sql.h和sqlext.h". RODBC/ROracle的安装中的讨论OS X Mavericks上的软件包表示以下内容:

In both cases, I got "ODBC headers sql.h and sqlext.h not found". A discussion of this in Installation of RODBC/ROracle packages on OS X Mavericks says the following:

要解决此问题,您需要下载最新版本的iODBC(www.iodbc.org),然后解压缩该文件并将标头和库搜索路径设置为放置解压缩程序包的位置.如果您不知道如何设置搜索路径,则可以仅将头文件(sql.hsqlext.h)放在/usr/include目录中,而将libiodbc.a文件放在/usr/lib目录中. /p>

To fix this, you need to download the latest version of iODBC (www.iodbc.org), and then unzip the file and set your header and library search paths to the location where you put the unzipped package. If you don't know how to set your search paths, you could just put the header files (sql.h and sqlext.h) in the /usr/include directory, and the libiodbc.a file in the /usr/lib directory.

我下载了iodbc-42.5.tar.gz并将其解压缩到RODBC旁边的目录中,该目录已从RODBC_1.3-15.tar.gz解压缩.可悲的是,我找不到如何设置标头和库搜索路径,并且当我尝试将标头文件放在/usr/include中时,系统不允许我这样做.

I downloaded iodbc-42.5.tar.gz and untarred it into a directory next to RODBC, untarred from RODBC_1.3-15.tar.gz. Sadly, I can't find how to set header and library search paths, and when I try to put the header files in /usr/include, the system won't let me.

iodbc-42.5/iodbc/README.MACOSX说,

您首先需要安装最新的Mac OS X开发人员软件包,可以在 http://developer中找到该软件包. .apple.com/tools

我认为我已经做到了,但是我不知道如何检查. [实际上,我认为我已经做过多次了:消息ODBC headers sql.h and sqlext.h not found从对install.packages('RODBC', type='source')的消极响应中消失了一段时间,直到我成功安装port并运行.然后我又得到了ODBC headers sql.h and sqlext.h not found.]

I think I've done that, but I don't know how to check it. [In fact, I think I've done it multiple times: The message ODBC headers sql.h and sqlext.h not found, disappeared for a while from the still-negative response to install.packages('RODBC', type='source'), only to reappear later after I successfully installed port and ran sudo port install gcc6. Then I got ODBC headers sql.h and sqlext.h not found again.]

iodbc-42.5/iodbc/README.MACOSX继续,

然后,您可以在mac/iODBCinstmac/iODBCmac/iODBCtestmac/iODBCtestw下打开Xcode Project Builder文件.

Then, you can open the Xcode Project Builder files under mac/iODBCinst, mac/iODBC, mac/iODBCtest and mac/iODBCtestw.

我不知道如何找到这些.进一步继续,

I don't know how find any of these. It further continues,

或在终端会话中执行以下命令以构建所有框架和演示应用程序:

or execute the following commands from a terminal session to build all the frameworks and demo applications:

$ cd mac
$ make

我做了$ cd mac并且得到了-bash: cd: mac: No such file or directory.显然,我需要在这里用mac代替,但是我不知道是什么. ???

I did $ cd mac and got -bash: cd: mac: No such file or directory. Evidently, I need to substitute something for mac here, but I don't know what. ???

谢谢.

推荐答案

我解决了以下问题:

ODBC_INCLUDE=/path/to/libiodbc-srcs/include R CMD INSTALL RODBC

其中"/path/to/libiodbc-srcs/include"是包含丢失文件"sql.h"和"sqlext.h"的"include"文件夹的路径.在我的情况下,它类似于〜/Documents/Rstuff/iodbc-42.5/iodbc/include",我在R中使用以下命令进行了检查:

where "/path/to/libiodbc-srcs/include" is the path to the "include" folder containing the missing files, "sql.h" and "sqlext.h". In my case it was something like '~/Documents/Rstuff/iodbc-42.5/iodbc/include', which I checked with the following in R:

dir('~/Documents/current/Rstuff/iodbc-42.5/iodbc/include')

然后以下内容对我有用:

Then the following worked for me:

ODBC_INCLUDE=~/Documents/current/Rstuff/iodbc-42.5/iodbc/include R CMD INSTALL RODBC

这在p中有描述. https://cran.r-project.org/web/packages/RODBC/vignettes/RODBC.pdf ,不同之处在于其中包含一个流浪引号(<'>),由于我不熟悉该语法,因此我在阅读本书的前几次就把它引掉了.

This is described in p. 19 of https://cran.r-project.org/web/packages/RODBC/vignettes/RODBC.pdf, except that contains a stray quote (<'>), which threw me off the first few times I read it, because was not familiar with that syntax.

在R-Sig-Mac上,马克·施瓦茨(Marc Schwartz)提供了两个建议:首先,在OS X Yosemite上安装RODBC ,可能与"brew"一起使用;我没有尝试过,因为我首先完成了上面的工作.

On R-Sig-Mac, Marc Schwartz offered two suggestions: First, Installation of RODBC on OS X Yosemite, which may work with "brew"; I didn't try that, because I got the above to work first.

第二:

install.packages("RODBC", type = "source", 
    configure.args = "--with-odbc-include=/path/to/libiodbc-srcs/include/")

这也应与上面提到的路径替换一起使用.

This should work also with the path substitution mentioned above.

我希望这对其他人有帮助.

I hope this helps someone else.

这篇关于如何在macOS Sierra 10.12.4上安装RODBC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆