Data Analysis R&PYTHON-RPY2 Package environment configuration

Source: Internet
Author: User

RPY2 Environment Configuration

 Recently, I want to integrate R into a web system with flask as a back-end framework, and perform data statistics analysis on the server side. The R language needs to be integrated into Python, and it is found that Rpy2 in Python can invoke the R language, so it took some time to configure the Rpy2. Do a summary.

  1. install R and configure the system environment

      ① Note: The version of R is compatible with the Python version. ② System Environment configuration (in my case): Add or modify in system variables and User variables: path: Add R.dll path such as: C:\program files\r\r-3.1.2\bin\x64 R_HOME: R installation path    such as: C:\program files\r \r-3.1.2 R_user:r installation path    such as: C: \program files\r\R-3.1.2  
  2. Installing the RPY2 Package

    ①在第三方库下载非官方Rpy2安装文件"XXX.whl",[网址][1]http://www.lfd.uci.edu/~gohlke/pythonlibs。注意:    !Rpy2包与R、python的版本要一致 !Rpy2与R必须都是32位或者都是64位②使用pip安装 打开CMD,转到python的安装目录,我的目录是c:\python27\scripts 输入代码:Pip install ‘XXX.whl’ 
  3. Test is configured successfully

       打开cmd,转到python的安装目录,输入测试代码:   Import rpy2.robjects as rb

Data Analysis R&PYTHON-RPY2 Package environment configuration

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.