【问题标题】:rpy2 installation with Anaconda 2 gives error message ' command "python setup.py.egg.info" failed with error 1使用 Anaconda 2 安装 rpy2 会给出错误消息“命令“python setup.py.egg.info”失败,错误 1
【发布时间】:2017-05-22 03:13:44
【问题描述】:

我正在尝试从 Anaconda 2 安装 rp2 包。

我已手动将 R exe 文件的路径添加到 Windows 8 环境变量中的 Path 字段中,现在 Path 具有以下值:

    C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\TXE Components\TCS\;C:\Program Files\Intel\TXE Components\TCS\;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Skype\Phone\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Microsoft SQL Server\130\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\130\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn\ManagementStudio\;C:\users\alex\Anaconda2;C:\users\alex\Anaconda2\Scripts;C:\users\alex\Anaconda2\Library\bin;C:\Program Files\R\R-3.3.2\bin;

然后,我打开 Windows Commander,移到 Anaconda 2 的 Script 子目录并写道:

    pip install rpy2

Pip 找到 rpy2 并下载,但它给了我以下输出,导致出现错误消息:

   C:\Users\ALEX\Anaconda2\Scripts>pip install rpy2 
   Collecting rpy2  
    Using cached rpy2-2.8.5.tar.gz                                                    
    Complete output from command python setup.py egg_info:                          
    R version 3.3.2 (2016-10-31) -- "Sincere Pumpkin Patch"                         
    Copyright (C) 2016 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                                    
    http://www.gnu.org/licenses/.                                                                                                                                   
   'sh' is not recognized as an internal or external command,                      
    operable program or batch file.                                                 
    R version 3.3.2 (2016-10-31) -- "Sincere Pumpkin Patch"                         
    C:\PROGRA~1\R\R-33~1.2\bin\x64\R CMD config --ldflags                           
    Traceback (most recent call last):                                                
    File "<string>", line 1, in <module>                                            
    File "c:\users\alex\appdata\local\temp\pip-build-p9qyoo\rpy2\setup.py", line 331, in <module>                                                                  
    ri_ext = getRinterface_ext()                                                  
    File "c:\users\alex\appdata\local\temp\pip-build-p9qyoo\rpy2\setup.py", 
    line 238, in getRinterface_ext                                                            
    ldf = shlex.split(' '.join(rexec.cmd_config('--ldflags')))                    
    File "c:\users\alex\appdata\local\temp\pip-build-p9qyoo\rpy2\setup.py", 
    line 191, in cmd_config                                                                   
    universal_newlines = True)                                                    
    File "C:\Users\ALEX\Anaconda2\lib\subprocess.py", line 574, in 
    check_output                                                                                       
    raise CalledProcessError(retcode, cmd, output=output)                       
    subprocess.CalledProcessError: Command '('C:\\PROGRA~1\\R\\R-
    33~1.2\\bin\\x64\\R', 'CMD', 'config', '--ldflags')' returned non-zero 
    exit status 1           
    ----------------------------------------------------------------------
    Command "python setup.py egg_info" failed with error code 1 in     c:\users\alex\appdata\local\temp\pip-build-p9qyoo\rpy2\

您的建议将不胜感激。

【问题讨论】:

    标签: python r installation rpy2


    【解决方案1】:

    您在分号后插入了一个空格:

    ...y\bin; C:\Program Files\R\R-3.3.2\bin;
             ^
             |
    

    您在系统中插入的路径实际上是C:\Program Files\R\R-3.3.2\bin:不起作用。

    把空格去掉就OK了。

    (要检查,请输入 where r 以查看 windows 是否找到它)

    【讨论】:

    • 谢谢。我按照你说的更正了它,但现在出现了一条新的错误消息。
    猜你喜欢
    • 1970-01-01
    • 2020-05-19
    • 1970-01-01
    • 1970-01-01
    • 2021-06-03
    • 2016-11-01
    • 2018-08-08
    • 2021-07-31
    • 1970-01-01
    相关资源
    最近更新 更多