oracle 如何在 Windows 7 上安装 ROracle 包?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18046324/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to install ROracle package on Windows 7?
提问by Matkrupp
I'm trying to install ROracle package on my Windows 7 client. I have Oracle Instant client and Rtools installed, DBI package is istalled, OCI32_LIB environmental variable has been set. But when I try to install from command line:
我正在尝试在我的 Windows 7 客户端上安装 ROracle 包。我安装了 Oracle Instant 客户端和 Rtools,安装了 DBI 包,设置了 OCI32_LIB 环境变量。但是当我尝试从命令行安装时:
C:\Temp>R CMD INSTALL --build ROracle_1.1-10.tar.gz
* installing to library 'C:/Users/myaccount/Documents/R/win-library/3.0'
* installing *source* package 'ROracle' ...
** package 'ROracle' successfully unpacked and MD5 sums checked
ERROR: configuration failed for package 'ROracle'
* removing 'C:/Users/myaccount/Documents/R/win-library/3.0/ROracle'
C:\Temp>
When I try to install from source:
当我尝试从源安装时:
> install.packages("ROracle",type = "source")
Warning in install.packages :
package ‘ROracle' is not available (for R version 3.0.0)
Installing package into ‘C:/Users/myaccount/Documents/R/win-library/3.0'
(as ‘lib' is unspecified)
trying URL 'http://cran.at.r-project.org/src/contrib/ROracle_1.1-10.tar.gz'
Content type 'application/x-gzip' length 168193 bytes (164 Kb)
opened URL
downloaded 164 Kb
* installing *source* package 'ROracle' ...
** package 'ROracle' successfully unpacked and MD5 sums checked
ERROR: configuration failed for package 'ROracle'
* removing 'C:/Users/myaccount/Documents/R/win-library/3.0/ROracle'
Warning in install.packages :
running command '"C:/PROGRA~1/R/R-30~1.0/bin/i386/R" CMD INSTALL -l "C:\Users\myaccount\Documents\R\win-library.0" C:\Users\myaccount\AppData\Local\Temp\RtmpGggbyp/downloaded_packages/ROracle_1.1-10.tar.gz' had status 1
Warning in install.packages :
installation of package ‘ROracle' had non-zero exit status
The downloaded source packages are in
‘C:\Users\myaccount\AppData\Local\Temp\RtmpGggbyp\downloaded_packages'
What should I do, how to proceed?
我该怎么办,如何进行?
回答by Josh Gilfillan
From http://jgilfillan.github.io/2016/05/28/how-to-install-roracle-in-windows-7/
来自http://jgilfillan.github.io/2016/05/28/how-to-install-roracle-in-windows-7/
Download binary from oracle: http://www.oracle.com/technetwork/database/database-technologies/r/roracle/downloads/index.html
从 oracle 下载二进制文件:http: //www.oracle.com/technetwork/database/database-technologies/r/roracle/downloads/index.html
The run the following command in r, substituting the file path:
在 r 中运行以下命令,替换文件路径:
setwd('xxxxx') # set to path of download
install.packages('ROracle_1.2-1.zip', repos = NULL)
Then load the library and use the package - you may have to change XXXX to whatever is in your TNS Names:
然后加载库并使用包 - 您可能需要将 XXXX 更改为 TNS 名称中的任何内容:
library('ROracle')
drv <- dbDriver("Oracle")
con <- dbConnect(drv, "USER GOES HERE", "PASSWORD GOES HERE", dbname='XXX')
test connection:
测试连接:
dbReadTable(con, 'DUAL')
Note that this has also been confirmed to work on Windows 10.
请注意,这也已确认适用于 Windows 10。
回答by nograpes
I had this exact problem as well, including the OCI_INC error. They actually talk about it in the INSTALL file in the .tar.gz package, you can read more there.
我也有这个确切的问题,包括 OCI_INC 错误。他们实际上在 .tar.gz 包中的 INSTALL 文件中讨论了它,您可以在那里阅读更多内容。
You have to set the OCI_INC
variable to the include
directory like this:
您必须像这样将OCI_INC
变量设置为include
目录:
set OCI_INC=C:\oracle\product.2.0\client_2\oci\include
Or whereever your file is. Here was my complete setup to get things installed from an Admin privileged command line.
或者无论您的文件在哪里。这是我从管理员特权命令行安装东西的完整设置。
set OCI_LIB64=C:\oracle\product.2.0\client_2\BIN
set OCI_INC=C:\oracle\product.2.0\client_2\oci\include
set PATH=C:\oracle\product.2.0\client_2\BIN;C:\Rtools\bin;c:\Rtools\gcc-4.6.3\bin;%PATH%
"C:/PROGRA~1/R/R-30~1.1/bin/x64/R" CMD INSTALL --build "C:/Your/Path/To/ROracle_1.1-10.tar.gz"
Also, make sure to change client_2
to client_1
and OCI_LIB64
to OCI_LIB32
if you are trying to do a 32-bit install.
此外,一定要改变client_2
到client_1
和OCI_LIB64
到OCI_LIB32
,如果你正在尝试做一个32位的安装。
回答by user1578653
I had exactly this problem. It was caused because when installing RTools I did not check the 'edit PATH' checkbox. I uninstalled RTools and reinstalled it again, this time making sure the checkbox was checked, and it worked first time! Hope this helps.
我正是有这个问题。这是因为在安装 RTools 时我没有选中“编辑路径”复选框。我卸载了 RTools 并重新安装了它,这次确保选中了复选框,并且第一次起作用了!希望这可以帮助。
回答by JeanVuda
After following the steps (highlighted in red boxes).
I also ran commands below on R.
So, everything went through well on a Windows 7 64-bit, R 3.4 64bit environment.
按照步骤操作后(以红色框突出显示)。我还在 R 上运行了下面的命令。
因此,在 Windows 7 64 位、R 3.4 64 位环境中一切顺利。
Sys.setenv(OCI_LIB64="C:/Oracle/instantclient_12_2/")
Sys.setenv(OCI_INC="C:/Oracle/product/11.2.0/client_1/oci/include")
install.packages("ROracle", dep=T)
回答by ddisqq
I had a similar error when trying to install ROracle from source.1
尝试从源代码安装 ROracle 时,我遇到了类似的错误。1
After searching around a bit I had to undertake what others have mentioned as well as redownloading the tar.gz. When I double checked the download size it was 10KB instead of 234KB.
在四处搜索之后,我不得不进行其他人提到的内容并重新下载 tar.gz。当我仔细检查下载大小时,它是 10KB 而不是 234KB。
- Re-Download source from: http://cran.r-project.org/web/packages/ROracle/index.html
Updated the following Environmental Varibles in windows
SET PATH=C:\Rtools\bin;C:\Rtools\gcc-4.6.3;%PATH% SET OCI_INC=C:\Oracle_11G_ClientR2\product\11.2.0\client_1\oci\include SET OCI_LIB32=C:\Oracle_11G_ClientR2\product\11.2.0\client_1\BIN SET OCI_LIB64=C:\Oracle_11G_ClientR2\product\11.2.0\client_1\BIN R CMD INSTALL --build "C:\temp\ROracle_1.1-12.tar.gz"
Output should look like the following:
- 重新下载源代码:http: //cran.r-project.org/web/packages/ROracle/index.html
在 windows 中更新了以下环境变量
SET PATH=C:\Rtools\bin;C:\Rtools\gcc-4.6.3;%PATH% SET OCI_INC=C:\Oracle_11G_ClientR2\product\11.2.0\client_1\oci\include SET OCI_LIB32=C:\Oracle_11G_ClientR2 \product\11.2.0\client_1\BIN SET OCI_LIB64=C:\Oracle_11G_ClientR2\product\11.2.0\client_1\BIN R CMD INSTALL --build "C:\temp\ROracle_1.1-12.tar.gz"
输出应如下所示:
1Here is what the previous error looked like:
1这是以前的错误的样子:
C:\Temp>R CMD INSTALL --build "C:\temp\ROracle_1.1-12.tar.gz"
Error in getOctD(x, offset, len) : invalid octal digit
回答by Александр Родионов
Along with the 'Basic Package' and the 'ODBC Package', with Oracle 11g, you should copy unpacked files from the 'SDK package' into the subdirectory instantclient_11_2
. In this case, you will not need to define the environment variable Sys.setenv (OCI_INC = "...")
.
除了“基本包”和“ ODBC 包”,在Oracle 11g 中,您还应该将“ SDK 包”中的解压文件复制到子目录中instantclient_11_2
。在这种情况下,您不需要定义环境变量Sys.setenv (OCI_INC = "...")
。
回答by Joe S.
This is what worked for me:
这对我有用:
Sys.setenv(OCI_LIB32="C:/oracle/product/12.1.0/client_1/BIN/")
Sys.setenv(OCI_INC="C:/oracle/product/12.1.0/client_1/oci/include/")
install.packages("ROracle")
回答by LoopBloke
install.packages("P:/Strategic-Primary/documentation/R/Packages/DBI_1.0.0.zip", repos = NULL, type = "win.binary")
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:
https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘C:/Users/xxx/Documents/R/win-library/3.6'
(as ‘lib' is unspecified)
package ‘DBI' successfully unpacked and MD5 sums checked
> setwd('E:\R\packages')
Error: '\R' is an unrecognized escape in character string starting "'E:\R"
> setwd('E:\R\packages')
> install.packages('ROracle-1.3.2.zip')
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:
https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘C:/Users/xxx/Documents/R/win-library/3.6'
(as ‘lib' is unspecified)
Warning in install.packages :
package ‘ROracle-1.3.2.zip' is not available (for R version 3.6.0)
> install.packages('ROracle-1.3.1.zip')
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:
https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘C:/Users/xxx/Documents/R/win-library/3.6'
(as ‘lib' is unspecified)
Warning in install.packages :
package ‘ROracle-1.3.1.zip' is not available (for R version 3.6.0)
> Sys.setenv(OCI_LIB32="C:/oracle/product/12.1.0/client_1/BIN/")
> Sys.setenv(OCI_INC="C:/oracle/product/12.1.0/client_1/oci/include/")
> install.packages("ROracle")
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:
https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘C:/Users/xxx/Documents/R/win-library/3.6'
(as ‘lib' is unspecified)
Package which is only available in source form, and may need compilation of C/C++/Fortran: ‘ROracle'
These will not be installed
> install.packages('ROracle-1.3.1.zip')
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:
https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘C:/Users/xxx/Documents/R/win-library/3.6'
(as ‘lib' is unspecified)
Warning in install.packages :
package ‘ROracle-1.3.1.zip' is not available (for R version 3.6.0)
> install.packages('ROracle-1.3.2.zip')
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:
https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘C:/Users/xxx/Documents/R/win-library/3.6'
(as ‘lib' is unspecified)
Warning in install.packages :
package ‘ROracle-1.3.2.zip' is not available (for R version 3.6.0)
I installed SDK, ODBC and basic install client (also set Env variable path) and it is still not working for me. Any advise pls?
我安装了 SDK、ODBC 和基本安装客户端(还设置了 Env 变量路径),但它仍然不适合我。任何建议请?