gpt4 book ai didi

python - python 3.7 上的 rpy2 3.2.0 存在导入 robjects 问题

转载 作者:行者123 更新时间:2023-12-02 06:57:25 26 4
gpt4 key购买 nike

python 3.7.3,rpy2 3.2.0,代码如下:

从 rpy2 导入 robjects

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File ".virtualenvs/flask3/lib/python3.7/site-packages/rpy2/robjects/__init__.py", line 14, in <module>
import rpy2.rinterface as rinterface
File ".virtualenvs/flask3/lib/python3.7/site-packages/rpy2/rinterface.py", line 6, in <module>
from rpy2.rinterface_lib import openrlib
File ".virtualenvs/flask3/lib/python3.7/site-packages/rpy2/rinterface_lib/openrlib.py", line 65, in <module>
_get_dataptr_fallback)
File ".virtualenvs/flask3/lib/python3.7/site-packages/rpy2/rinterface_lib/openrlib.py", line 50, in _get_symbol_or_fallback
res = getattr(rlib, symbol)
RuntimeError: found a situation in which we try to build a type recursively. This is known to occur e.g. in ``struct s { void(*callable)(struct s); }''. Please report if you get this error and really need support for your case.

发生什么事了?这看起来像是 rypy2 的标准过程,实际上也是我们在 python 2 下使用它的方式。

同样的问题适用于任何类型的 rpy2 导入:import rpy2.robjects.tests 等。

最佳答案

我遇到了同样的问题,并发现了上面链接的@ejolly 相同的问题。为了解决这个问题,我将 cffi 库从 1.13.0 降级到 1.12.3

pip install cffi==1.12.3

效果非常好。

关于python - python 3.7 上的 rpy2 3.2.0 存在导入 robjects 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58400442/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com