简体   繁体   中英

Installation of RODBC on OS X Yosemite

When installing the R package RODBC in RStudio on OS X Yosemite, I get the following error:

configure: error: "ODBC headers sql.h and sqlext.h not found"

This is a common error and indicates that ODBC drivers haven't been installed (iODBC headers aren't included in OS 10.9 hence the separate install required). So, I install unixODBC and confirm that the header files are present in the PATH.

Sys.getenv("PATH") gives me the correct path including where the two files are found.

However, when I try install.packages("RODBC",type = "source") again, the same error persists. Have tested this with iODBC as well as unixODBC.

Are there any other tests I can perform to help diagnose the issue?

We have a bunch of Yosemite systems with R 3.1.2 that are all up-to-date with Xcode & Xcode command-line tools. The following consistently works with each major R update or new system install (at the Terminal):

brew update && brew install unixODBC && \
  wget "http://cran.r-project.org/src/contrib/RODBC_1.3-10.tar.gz" && \
  R CMD INSTALL RODBC_1.3-10.tar.gz 

It (obviously) requires Homebrew, but that's what we've standardized on in our shop.

As RODBC is updated, the version number (1.3-10, 1.3-11, ...) will change. To find out the current version, look at https://cran.r-project.org/web/packages/RODBC/index.html .

我在拨打RODBC_1.3-10.tar.gz时得到了404,所以我对上面的脚本进行了一些微小的改动,结果很好:brew update && brew install unixODBC && wget“ http://cran.r-project.org /src/contrib/RODBC_1.3-11.tar.gz“&& R CMD INSTALL RODBC_1.3-11.tar.gz

I'm using OS X Yosemite 10.10.5, R version 3.2.2. By following below steps, I'm able to make it work.

  1. brew install unixodbc
  2. brew link unixodbc (if missing this step, R still can not find those header files)
  3. install.packages('RODBC', type='source')

在我的OS X Yosemite系统上安装了unixODBC,从MacPorts和R 3.3.2安装, install.packages()失败(无论是来自repo还是来自我本地保存的tarball),但是R CMD INSTALL RODBC_1.3-14.tar.gz工作。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM