这是我的代码片段,我在python中安装R库RPostgreSQL
import rpy2.robjects as robjects
import rpy2.robjects.packages as rpackages
utils = rpackages.importr('utils')
utils.install_packages('RPostgreSQL')
但它会出错:
RRuntimeError Traceback (most recent call last)
<ipython-input-7-04e0baa1a451> in <module>()
----> 1 utils.install_packages('RPostgreSQL')
c:\users\postgres\appdata\local\programs\python\python36\lib\site-
packages\rpy2\robjects\functions.py in __call__(self, *args, **kwargs)
176 v = kwargs.pop(k)
177 kwargs[r_k] = v
--> 178 return super(SignatureTranslatedFunction,
self).__call__(*args, **kwargs)
179
180 pattern_link = re.compile(r'\\link\{(.+?)\}')
c:\users\postgres\appdata\local\programs\python\python36\lib\site-
packages\rpy2\robjects\functions.py in __call__(self, *args, **kwargs)
104 for k, v in kwargs.items():
105 new_kwargs[k] = conversion.py2ri(v)
--> 106 res = super(Function, self).__call__(*new_args,
**new_kwargs)
107 res = conversion.ri2ro(res)
108 return res
RRuntimeError: Error in (function (pkgs, lib, repos = getOption("repos"),
contriburl = contrib.url(repos, :
unable to install packages
我已经尝试了很多建议,这是我的.libpaths和库postgresql都安装在两者中。有什么帮助吗?
"C:/Users/postgres/R/win-library/3.5"
"C:/Program Files/R/R-3.5.0/library"