pipenv和rpy2-错误:试图猜测R的主目录,但在路径

时间:2018-11-13 10:11:50

标签: python r virtualenv rpy2 pipenv

我正在尝试在数据分析项目上使用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的人的例子却找不到很多。

我对我是否可以使virtualenv中的rpy2知道R的居住位置感到好奇(如果那是怎么回事)。

任何非常感谢的建议,我想尝试解决这个问题也可能对其他人有用。

更新

我已经在Windows的Path变量中添加了R,现在出现如下所示的新错误。因此,希望我下载Visual C ++后能解决此问题

        ...
copying .\rpy\ipython\html.py -> build\lib.win-amd64-3.7\rpy2\ipython
        copying .\rpy\ipython\rmagic.py -> build\lib.win-amd64-3.7\rpy2\ipython
        copying .\rpy\ipython\__init__.py -> build\lib.win-amd64-3.7\rpy2\ipython
        creating build\lib.win-amd64-3.7\rpy2\ipython\tests
        copying .\rpy\ipython\tests\test_rmagic.py -> build\lib.win-amd64-3.7\rpy2\ipython\tests
        copying .\rpy\ipython\tests\__init__.py -> build\lib.win-amd64-3.7\rpy2\ipython\tests
        warning: build_py: byte-compiling is disabled, skipping.

        running build_clib
        building 'r_utils' library
        error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/

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

    Error:  An error occurred while installing rpy2==2.9.4!
      Failed building wheel for rpy2
    Command "c:\users\amaguire\.virtualenvs\ami-swtbbbw7\scripts\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\amaguire\\AppData\\Local\\Temp\\pip-install-kmzhepx1\\rpy2\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\amaguire\AppData\Local\Temp\pip-record-zgsh7n25\install-record.txt --single-version-externally-managed --compile --install-headers c:\users\amaguire\.virtualenvs\ami-swtbbbw7\include\site\python3.7\rpy2" failed with error code 1 in C:\Users\amaguire\AppData\Local\Temp\pip-install-kmzhepx1\rpy2\

0 个答案:

没有答案