安装rpy2错误:“sh”未被识别为内部或外部命令、可操作程序或批处理fi

2024-10-01 17:26:58 发布

您现在位置:Python中文网/ 问答频道 /正文

我尝试安装rpy2,但下面有一个错误。在

我在网上读到问题出在环境变量上,但我在系统变量路径中有C:\Rtools\binC:\Program Files\R\R-3.2.2\bin。在

我做错什么了?在

错误:

C:\Users\rmalveslocal>pip install rpy2
Collecting rpy2

  Downloading rpy2-2.7.6.tar.gz (177kB)
    100% |################################| 180kB 1.3MB/s

    Complete output from command python setup.py egg_info:
    R version 3.2.2 (2015-08-14) -- "Fire Safety"
    Copyright (C) 2015 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.2.2 (2015-08-14) -- "Fire Safety"
    C:\PROGRA~1\R\R-32~1.2\bin\x64\R CMD config --ldflags
    Traceback (most recent call last):
      File "<string>", line 20, in <module>

      File "c:\users\rmalve~1\appdata\local\temp\2\pip-build-vvy8sl\rpy2\setup.p
y", line 291, in <module>
        ri_ext = getRinterface_ext()
      File "c:\users\rmalve~1\appdata\local\temp\2\pip-build-vvy8sl\rpy2\setup.p
y", line 198, in getRinterface_ext
        ldf = shlex.split(' '.join(rexec.cmd_config('--ldflags')))
      File "c:\users\rmalve~1\appdata\local\temp\2\pip-build-vvy8sl\rpy2\setup.p
y", line 151, in cmd_config
        universal_newlines = True)
      File "C:\Users\rmalveslocal\Anaconda\lib\subprocess.py", line 573, in chec
k_output
        raise CalledProcessError(retcode, cmd, output=output)
    subprocess.CalledProcessError: Command '('C:\\PROGRA~1\\R\\R-32~1.2\\bin\\x6
4\\R', 'CMD', 'config', '--ldflags')' returned non-zero exit status 1

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in c:\users\rmalve~1
\appdata\local\temp\2\pip-build-vvy8sl\rpy2

Tags: pipinbuildconfigoutputbinlocalsetup
2条回答
  1. 在此处下载您需要的版本http://www.lfd.uci.edu/~gohlke/pythonlibs/#rpy2
  2. 打开Anaconda提示符并导航到已下载文件的文件夹
  3. 运行pip安装文件_姓名.whl在

解决方法:

'sh' is not recognized as an internal or external command, operable program or batch file.

您需要将sh.exe添加到路径中。一些程序,如GitHub桌面(例如,C:\Users\bob\AppData\Local\GitHubDesktop\app-0.7.0\resources\app\git\usr\bin)或Cygwin都附带sh.exe。在

我推荐http://www.lfd.uci.edu/~gohlke/pythonlibs/#rpy2+例如pip install rpy2-2.8.6-cp36-cp36m-win_amd64.whl,正如康斯坦丁诺斯·伊万杰里迪斯所说,它使生活更容易。在

下一步可能是:Rpy2 error wac-a-mole: R_USER not defined

相关问题 更多 >

    热门问题