0

在 R 中(以及安装 ROracle 包时),如何设置 OCI_LIB64?我已经下载了 Oracle Instant Client 并将 wd 和 OCI_LIB64 指向它。我有 Windows 10 企业版。它是 RStudio 版本 1.1.463 和 R 版本 3.4.3。

我尝试了以下方法:

setwd('C:\\Users\\sriley03\\Documents\\')   # set to path of download (remember to escape slashes ie:  c:\\users\\etc..)
set OCI_LIB64=C:\Users\sriley03\Documents\instantclient_19_3
install.packages('ROracle_1.3-1.tar.gz', repos = NULL)

但我得到以下输出和错误:

> setwd('C:\\Users\\sriley03\\Documents\\')   # set to path of download (remember to escape slashes ie:  c:\\users\\etc..)
The working directory was changed to C:/Users/sriley03/Documents/ inside a notebook chunk. The working directory will be reset when the chunk is finished running. Use the knitr root.dir option in the setup chunk to change the working directory for notebook chunks.Error: unexpected symbol in "set OCI_LIB64"

> setwd('C:\\Users\\sriley03\\Documents\\instantclient_19_3')   # set to path of download (remember to escape slashes ie:  c:\\users\\etc..)
The working directory was changed to C:/Users/sriley03/Documents/instantclient_19_3 inside a notebook chunk. The working directory will be reset when the chunk is finished running. Use the knitr root.dir option in the setup chunk to change the working directory for notebook chunks.> set OCI_LIB64=C:\Users\sriley03\Documents\instantclient_19_3
Error: unexpected symbol in "set OCI_LIB64"

> install.packages('ROracle_1.3-1.tar.gz', repos = NULL)
Warning: invalid package 'ROracle_1.3-1.tar.gz'
Error: ERROR: no packages specified
In R CMD INSTALL
Warning in install.packages :
  running command '"C:/PROGRA~1/R/R-34~1.3/bin/x64/R" CMD INSTALL -l "C:\Program Files\R\R-3.4.3\library" "ROracle_1.3-1.tar.gz"' had status 1
Warning in install.packages :
  installation of package ‘ROracle_1.3-1.tar.gz’ had non-zero exit status

我该怎么做才能正确设置 OCI_LIB64 以便安装 ROracle?

谢谢!

更新(8_28_19):

我已将 OCI_LIB64 和 OCI_INC 设置为正确的路径

Sys.setenv(OCI_LIB64="C:\\Users\\sriley03\\Documents\\oreclient_install_dir\\instantclient_19_3")
Sys.setenv(OCI_INC="C:\\Users\\sriley03\\Documents\\oreclient_install_dir\\instantclient_19_3")

但是现在我得到以下响应(即使所有必需的标头都在该文件中):

* installing *source* package 'ROracle' ...
** package 'ROracle' successfully unpacked and MD5 sums checked
Oracle Client Shared Library 64-bit - 19.3.0.0.0 Operating in Instant Client mode.
found Oracle Client C:\Users\sriley03\Documents\oreclient_install_dir\instantclient_19_3
found Oracle Client include C:\Users\sriley03\Documents\oreclient_install_dir\instantclient_19_3
ERROR: cannot find Oracle Client include headers in C:\Users\sriley03\Documents\oreclient_install_dir\instantclient_19_3.
       Please set OCI_INC to correct location.
Warning: running command 'sh ./configure.win' had status 1
ERROR: configuration failed for package 'ROracle'
* removing 'C:/Program Files/R/R-3.4.3/library/ROracle'
In R CMD INSTALL
Warning in install.packages :
  running command '"C:/PROGRA~1/R/R-34~1.3/bin/x64/R" CMD INSTALL -l "C:\Program Files\R\R-3.4.3\library" C:\Users\sriley03\AppData\Local\Temp\RtmpWUfabz/downloaded_packages/ROracle_1.3-1.tar.gz' had status 1
4

1 回答 1

1

尝试从Oracle下载 SDK 包并将其解压缩到您的即时客户端文件夹中。

将 OCI_INC 设置为 ..."instantclient_xx_x\sdk\include"

然后,重新安装软件包。

如果您仍然收到失败错误,请尝试将所有文​​件从 sdk\include 文件夹复制到您的 R 包含文件夹,然后重试

于 2020-04-22T20:35:38.187 回答