rpy2 install on windows 7

前端 未结 9 928
轮回少年
轮回少年 2020-11-27 02:50

I\'m trying to install rpy2 on my computer, but I wasn\'t able to do it.

I downloaded the source package and I tryed to install Rpy2 (rpy2-2.3.2) using the command <

9条回答
  •  面向向阳花
    2020-11-27 03:26

    OK. From previous experience I've found there are not many instructions on how to install rpy2 on Windows. I get that it's not officially supported but it's really not that hard. In a few steps I'll show what I did and maybe others can follow.

    These instructions will most likely only work for Python 2.7+ and R 3.2+ but will probably work for R 3.0+. I am putting the paths that I've used on my system. Make sure to modify the paths accordingly:

    First, make sure any previous rpy2 installations are UNINSTALLED before trying these steps (and obviously have R 3.2+ before installing).

    1. Download the .whl file for r2py from here
    2. Install the .whl file using pip install [put .whl filename here] (in the command line) from the directory where the file was downloaded
    3. Append a path similar to C:\Program Files\R\R-3.2.0\bin to your PATH environment variable
    4. Create a R_HOME system variable with a value similar to: C:\Program Files\R\R-3.2.0
    5. Create a R_USER system variable with your user name
    6. Create a R_LIBS_USER system variable with a path to the folder where external R packages are/will be installed.

    That's it. Open up a command prompt and enter the command R. This should start an R session and display version information.

    Now open up python and run this line to see if things worked out or not:

    import rpy2.robjects as robjects 
    

    Hopefully this helps.

提交回复
热议问题