首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在装有OSX10.7.2的Mac上安装RPostgresql

在装有OSX10.7.2的Mac上安装RPostgresql
EN

Stack Overflow用户
提问于 2011-12-01 04:57:33
回答 3查看 1K关注 0票数 2

我正在尝试在mac上安装rpostgresql。我希望能够使用IP地址连接到服务器并将数据读取到数据帧中。我从CRAN下载了这个包,并运行以下代码行:

代码语言:javascript
复制
install.packages('/Users/celenius/Downloads/RPostgreSQL_0.2-1.tar.gz', type='source')

这开始编译程序包,但导致出现以下错误消息:

代码语言:javascript
复制
> install.packages('/Users/celenius/Downloads/RPostgreSQL_0.2-1.tar.gz', type='source')
Installing package(s) into ‘/Library/Frameworks/R.framework/Versions/2.14/Resources/library’
(as ‘lib’ is unspecified)
inferring 'repos = NULL' from the file name
* installing *source* package ‘RPostgreSQL’ ...
** package ‘RPostgreSQL’ successfully unpacked and MD5 sums checked
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
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 pg_config... /usr/bin/pg_config
checking for "/usr/include/libpq-fe.h"... yes
configure: creating ./config.status
config.status: creating src/Makevars
** libs
*** arch - x86_64
gcc-4.2 -arch x86_64 -std=gnu99 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/x86_64 -I/usr/include -I/usr/local/include    -fPIC  -g -O2 -c RS-DBI.c -o RS-DBI.o
make: gcc-4.2: No such file or directory
make: *** [RS-DBI.o] Error 1
ERROR: compilation failed for package ‘RPostgreSQL’
* removing ‘/Library/Frameworks/R.framework/Versions/2.14/Resources/library/RPostgreSQL’
Warning in install.packages :
  installation of package ‘/Users/celenius/Downloads/RPostgreSQL_0.2-1.tar.gz’ had non-zero exit status

我浏览了rpostgresql网页(12)上的建议,但很多建议已经有一年多的历史了,所以我想可能会有更新的关于如何安装这个软件包的建议。

EN

回答 3

Stack Overflow用户

发布于 2011-12-01 17:31:16

如果你想连接到postgre数据库,你也可以使用RODBC。只需安装一个ODBC驱动程序(Lion应该已经包含postgres的驱动程序),您就可以开始工作了。我这样做是为了连接到我本地的postgre / postgis服务器,它工作得很好。

票数 1
EN

Stack Overflow用户

发布于 2011-12-01 05:23:44

你需要安装Xcode才能编译。进入Mac应用商店搜索,然后安装Xcode。这是免费的。

您可以通过快速执行which gcc-4.2来判断您是否已经拥有了gcc。我的猜测是你不知道。在安装Xcode之后,你应该会得到/usr/bin/gcc-4.2的响应。

*编辑*

在评论了你是如何安装Xcode的,但是仍然没有安装gcc-4.2之后,我做了一点阅读,看起来你需要做这个堆栈溢出问题中列出的选项之一:Setting GCC 4.2 as the default compiler on Mac OS X Leopard

这让我想知道我的gcc-4.2是从哪里来的。可能是我刚拿到MBP的时候发生的意外。

票数 0
EN

Stack Overflow用户

发布于 2017-06-01 03:14:16

由于从源代码构建包需要postgresql,因此您需要安装它。如果您使用homebrew,最简单的方法是在终端中执行以下操作:

代码语言:javascript
复制
## install postgresql
brew install postgresql

## install the R package
Rscript -e "install.packages('RPostgreSQL', type = 'source')"

## remove postgresql (optional)
brew remove postgresql
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/8332842

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档