运行时错误:请确保安装了R(已编辑)

2024-09-19 23:42:18 发布

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

我正在尝试使用github(https://github.com/LBNL-ETA/loadshape)的loadshape包

当我打字的时候

pip install git+https://bitbucket.org/berkeleylab/eetd-loadshape.git@master

出现以下错误

Collecting git+https://bitbucket.org/berkeleylab/eetd-loadshape.git@master
  Cloning https://bitbucket.org/berkeleylab/eetd-loadshape.git (to revision master) to c:\users\fulld\appdata\local\temp\pip-req-build-4_g9awz1
  Running command git clone -q https://bitbucket.org/berkeleylab/eetd-loadshape.git 'C:\Users\fulld\AppData\Local\Temp\pip-req-build-4_g9awz1'
    ERROR: Command errored out with exit status 1:
     command: 'C:\Users\fulld\anaconda3\envs\MRCH\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\fulld\\AppData\\Local\\Temp\\pip-req-build-4_g9awz1\\setup.py'"'"'; __file__='"'"'C:\\Users\\fulld\\AppData\\Local\\Temp\\pip-req-build-4_g9awz1\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\fulld\AppData\Local\Temp\pip-req-build-4_g9awz1\pip-egg-info'
         cwd: C:\Users\fulld\AppData\Local\Temp\pip-req-build-4_g9awz1\
    Complete output (7 lines):
    'R' is not recognized as an internal or external command,
    operable program or batch file.
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\fulld\AppData\Local\Temp\pip-req-build-4_g9awz1\setup.py", line 42, in <module>
        if len(RHOME) == 0: raise RuntimeError("Please make sure R is installed.")
    RuntimeError: Please make sure R is installed.
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

我尝试了其他人提供的以下解决方案:

  1. pip install auto-py-to-exe
  2. 已删除anaconda并在选中变量路径的情况下重新安装
  3. 将我的电脑设置语言更改为英语
  4. pip install pygetwindow==0.0.1
  5. pip install -U setuptools
  6. conda install -c r r-base
  7. conda install git

但它们似乎都不起作用,第6号和第7号试验也打印出了错误(PackagesNotFoundError)

我真的很感激任何帮助我解决我面临的问题,因为我完全迷路了

------编辑------

我的计算机上已经安装了R, at C:\Program Files\R\R-4.0.4

但是错误出现了。我必须将程序文件重新定位到某个地方吗


Tags: installpippyhttpsgitbuildbitbucketlocal
3条回答
'R' is not recognized as an internal or external command,

这建议您应该安装R language software,这样当您在terminal interactive R控制台中键入R时,就会出现

如果使用专用安装程序安装R,则只需将PATH环境变量设置为包含R.exe目录。如果您尚未安装R,并且正在Windows上使用Anaconda,那么您确实可以install R with conda。这样做之后,可以插入一个步骤来重新启动Anaconda提示符

  1. 安装Anaconda或Miniconda,根据用户指南说明(例如conda create -n r_env),可以选择创建新的Python 3环境

  2. 打开Anaconda提示符(如果使用环境,也可以conda activate r_env

  3. 确保您有基本的软件包:conda install git pip setuptools

  4. 通过conda安装R:conda install -c r r-essentials r-base r-optparse

  5. 尝试运行R:R。如果它没有启动交互式R会话,请关闭Anaconda提示符并再次打开它。检查path。我在路径中有类似C:\Users\User1\AppData\Local\Continuum\anaconda3\envs\r-env\Scripts的内容,其中有R.exe

  6. 最后安装包pip install git+https://bitbucket.org/berkeleylab/eetd-loadshape.git@master

  7. 测试它:python -c "import loadshape"。如果此时出现错误,请使用pip uninstall loadshape卸载包,然后使用git克隆存储库并进行调试。了解包使用的Python版本可能会有所帮助

这意味着,首先,您要安装R language。然后,修复错误

相关问题 更多 >