gpt4 book ai didi

python - 尝试在 Python 中运行 RPY2 并收到错误 0X7e

转载 作者:行者123 更新时间:2023-12-03 19:09:25 24 4
gpt4 key购买 nike

我正在尝试运行 RPY2 以利用 R 中的 TTR 包,并运行 python 3.8.3 和 R 4.0.2。但是,当尝试运行代码时

os.environ['R_HOME'] = "C:\\Program Files\\R\\R-4.0.2\\bin\\x64"
from rpy2.robjects.packages import importr'
这导致:
OSError: cannot load library 'C:\Program Files\R\R-4.0.2\bin\x64\bin\x64\R.dll': error 0x7e
我主动跑了 python -m rpy2.situation,结果
C:\Users\XXXXX>python -m rpy2.situation
rpy2 version:
3.3.4
Python version:
3.8.3rc1 (tags/v3.8.3rc1:802eb67, Apr 29 2020, 21:39:14) [MSC v.1924 64 bit (AMD64)]
Looking for R's HOME:
Environment variable R_HOME: None
InstallPath in the registry: C:\Program Files\R\R-4.0.2
Environment variable R_USER: None
Environment variable R_LIBS_USER: None
R version:
R version 4.0.2 (2020-06-22) -- "Taking Off Again"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under the terms of the
GNU General Public License versions 2 or 3.
For more information about these matters see
https://www.gnu.org/licenses/.

In the PATH:
Loading R library from rpy2: OK
Additional directories to load R packages from:
None
C extension compilation:
'sh' is not recognized as an internal or external command,
operable program or batch file.
Warning: Unable to get R compilation flags.
非常感谢有关为什么 RPY2 导致此 0x7e 错误的任何帮助。我还卸载并重新安装了 R 和 RPY2,因为我在其他一些帖子的解决方案中发现了这一点。

最佳答案

我在尝试导入 rpy2 库时遇到了同样的问题。当我在环境变量中为 R 添加路径时,我对它进行了排序。
***注册表中的安装路径:C:\Program Files\R\R-4.0.2
尝试使用上述创建系统环境变量的路径,看看它是否有效

关于python - 尝试在 Python 中运行 RPY2 并收到错误 0X7e,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62596681/

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