OSError: cannot load library 'C:\Program Files\R\R-4.0.2\bin\x64\R.dll': error 0x7e

前端 未结 2 367
夕颜
夕颜 2020-11-30 15:04

I am trying to import the rpy2 library into a Jupyter Notebook but I cannot get past this error.

The PATH \'C:\\Program Files\\R\\R-4.0.2\\bin\\x64\' has been added.<

相关标签:
2条回答
  • 2020-11-30 15:27

    Here is my working solution:

    import os
    os.environ["R_HOME"] = r"D:\Install\R\R-3.6.1"
    os.environ["PATH"]   = r"D:\Install\R\R-3.6.1\bin\x64" + ";" + os.environ["PATH"]
    import rpy2
    from rpy2.robjects import pandas2ri, packages
    pandas2ri.activate()
    stats = packages.importr('stats')
    
    0 讨论(0)
  • 2020-11-30 15:28

    I found a solution here.

    Adding the PATH

    C:\Users\username\Anaconda2;C:\Users\username\Anaconda2\Scripts;C:\Users\username\Anaconda2\Library\bin;C:\Users\username\Anaconda2\Library\mingw-w64\lib;C:\Users\username\Anaconda2\Library\mingw-w64\bin

    and subsequently restarting Anaconda fixed the issue.

    0 讨论(0)
提交回复
热议问题