pipenv和rpy2错误:试图猜测R的HOME,但路径中没有命令“R”

2024-06-10 15:42:08 发布

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

我试图在一个数据分析项目中使用pipenv,并且需要使用R中的Twitter Anomaly Detection package

尝试pipenv install rpy2时出错

下面是我的代码创建一个pipenv文件夹并尝试在其中安装rpy2。在

PS C:\Users\amaguire\Documents\LocalWork\rp2_pipenv_example> pipenv --python 3.7
Creating a virtualenv for this project…
Pipfile: C:\Users\amaguire\Documents\LocalWork\rp2_pipenv_example\Pipfile
Using C:/Users/amaguire/AppData/Local/Continuum/anaconda3/python.exe (3.7.0) to create virtualenv…
Running virtualenv with interpreter C:/Users/amaguire/AppData/Local/Continuum/anaconda3/python.exe
Using base prefix 'C:\\Users\\amaguire\\AppData\\Local\\Continuum\\anaconda3'
New python executable in C:\Users\amaguire\.virtualenvs\rp2_pipenv_example-MDtFv_K4\Scripts\python.exe
Installing setuptools, pip, wheel...
done.

Virtualenv location: C:\Users\amaguire\.virtualenvs\rp2_pipenv_example-MDtFv_K4
Creating a Pipfile for this project…
PS C:\Users\amaguire\Documents\LocalWork\rp2_pipenv_example> pipenv install rpy2
Installing rpy2…
Collecting rpy2
  Using cached https://files.pythonhosted.org/packages/f1/98/c7652cc9d7fc0afce74d2c30a52b9c9ac391713a63d037e4ab8feb56c530/rpy2-2.9.4.tar.gz
    Complete output from command python setup.py egg_info:
    Error: Tried to guess R's HOME but no command 'R' in the PATH.

    ----------------------------------------

Error:  An error occurred while installing rpy2!
Command "python setup.py egg_info" failed with error code 1 in C:\Users\amaguire\AppData\Local\Temp\pip-install-8h23my82\rpy2\

This is likely caused by a bug in rpy2. Report this to its maintainers.
PS C:\Users\amaguire\Documents\LocalWork\rp2_pipenv_example>

我看了一下,但是没有找到很多人在virtualenv或pipenv中使用rpy2的例子。在

我很好奇,如果我能做些什么,使rpy2在virtualenv知道R住在哪里(如果这就是发生的事情)。在

任何一个非常感激的建议,我想对其他人来说都是有用的。在

更新

我已经将R添加到windows中的路径变量中,现在得到一个新的错误,如下所示。所以我希望一旦我下载Visual C++ +/p>就可以解决它。 ^{pr2}$


Tags: installinvirtualenvexamplelocalpipenvthisusers