为什么我无法在 Windows 10 上安装适用于 Python 的 rpy2?

2023-12-29

我正在尝试安装该软件包rpy2将 R 与 Python 结合使用。但是使用 pip install 安装失败。

我在 Windows 10 上将 R 和 Python 与 Microsoft Visual Studio 2017 结合使用。安装了适用于 Visual Studio 的 R 和 Python 工具。我尝试安装rpy2使用 python 环境从 Visual Studio 中。但它失败了。

我也下载了rpy2-2.9.5-cp37-cp37m-win_amd64.whl from lfd.uci.edu https://www.lfd.uci.edu/~gohlke/pythonlibs/并尝试使用 cmd 安装它pip install它也失败了。

我也设置了R-Home指向我的 R 安装的 R 二进制文件的变量。

我尝试过的命令:pip install rpy2(在视觉工作室中)

pip install rpy2-2.9.5-cp37-cp37m-win_amd64.whl(使用cmd)

安装时出现如下错误信息rpy2在 Visual Studio 2017 中:

----- "rpy2==3.0.5" wird installiert -----
Collecting rpy2==3.0.5
  Using cached https://files.pythonhosted.org/packages/c7/43/401afad8556bf92b08bd7d422cacac614b0e8dd2bce31848318bbcb18f48/rpy2-3.0.5.tar.gz
    ERROR: Command errored out with exit status 1:
     command: 'C:\Users\eisem\AppData\Local\Programs\Python\Python37-32\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\eisem\\AppData\\Local\\Temp\\pip-install-afwht5_8\\rpy2\\setup.py'"'"'; __file__='"'"'C:\\Users\\eisem\\AppData\\Local\\Temp\\pip-install-afwht5_8\\rpy2\\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 pip-egg-info
         cwd: C:\Users\eisem\AppData\Local\Temp\pip-install-afwht5_8\rpy2\
    Complete output (69 lines):
    warning: no previously-included files found matching 'setup.pyc'
    warning: no previously-included files matching 'yacctab.*' found under directory 'tests'
    warning: no previously-included files matching 'lextab.*' found under directory 'tests'
    warning: no previously-included files matching 'yacctab.*' found under directory 'examples'
    warning: no previously-included files matching 'lextab.*' found under directory 'examples'
    zip_safe flag not set; analyzing archive contents...
    pycparser.ply.__pycache__.lex.cpython-37: module references __file__
    pycparser.ply.__pycache__.lex.cpython-37: module MAY be using inspect.getsourcefile
    pycparser.ply.__pycache__.yacc.cpython-37: module references __file__
    pycparser.ply.__pycache__.yacc.cpython-37: module MAY be using inspect.getsourcefile
    pycparser.ply.__pycache__.yacc.cpython-37: module MAY be using inspect.stack
    pycparser.ply.__pycache__.ygen.cpython-37: module references __file__

    Installed c:\users\eisem\appdata\local\temp\pip-install-afwht5_8\rpy2\.eggs\pycparser-2.19-py3.7.egg
    Traceback (most recent call last):
      File "c:\users\eisem\appdata\local\temp\pip-install-afwht5_8\rpy2\.eggs\cffi-1.12.3-py3.7-win32.egg\cffi\cparser.py", line 294, in _parse
        ast = _get_parser().parse(fullcsource)
      File "c:\users\eisem\appdata\local\temp\pip-install-afwht5_8\rpy2\.eggs\pycparser-2.19-py3.7.egg\pycparser\c_parser.py", line 152, in parse
        debug=debuglevel)
      File "c:\users\eisem\appdata\local\temp\pip-install-afwht5_8\rpy2\.eggs\pycparser-2.19-py3.7.egg\pycparser\ply\yacc.py", line 331, in parse
        return self.parseopt_notrack(input, lexer, debug, tracking, tokenfunc)
      File "c:\users\eisem\appdata\local\temp\pip-install-afwht5_8\rpy2\.eggs\pycparser-2.19-py3.7.egg\pycparser\ply\yacc.py", line 1199, in parseopt_notrack
        tok = call_errorfunc(self.errorfunc, errtoken, self)
      File "c:\users\eisem\appdata\local\temp\pip-install-afwht5_8\rpy2\.eggs\pycparser-2.19-py3.7.egg\pycparser\ply\yacc.py", line 193, in call_errorfunc
        r = errorfunc(token)
      File "c:\users\eisem\appdata\local\temp\pip-install-afwht5_8\rpy2\.eggs\pycparser-2.19-py3.7.egg\pycparser\c_parser.py", line 1848, in p_error
        column=self.clex.find_tok_column(p)))
      File "c:\users\eisem\appdata\local\temp\pip-install-afwht5_8\rpy2\.eggs\pycparser-2.19-py3.7.egg\pycparser\plyparser.py", line 67, in _parse_error
        raise ParseError("%s: %s" % (coord, msg))
    pycparser.plyparser.ParseError: <cdef source string>:23:5: before: blah1

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\eisem\AppData\Local\Temp\pip-install-afwht5_8\rpy2\setup.py", line 184, in <module>
        'rpy2': ['doc/source/rpy2_logo.png', ]}
      File "C:\Users\eisem\AppData\Local\Programs\Python\Python37-32\lib\site-packages\setuptools\__init__.py", line 145, in setup
        return distutils.core.setup(**attrs)
      File "C:\Users\eisem\AppData\Local\Programs\Python\Python37-32\lib\distutils\core.py", line 108, in setup
        _setup_distribution = dist = klass(attrs)
      File "C:\Users\eisem\AppData\Local\Programs\Python\Python37-32\lib\site-packages\setuptools\dist.py", line 447, in __init__
        k: v for k, v in attrs.items()
      File "C:\Users\eisem\AppData\Local\Programs\Python\Python37-32\lib\distutils\dist.py", line 292, in __init__
        self.finalize_options()
      File "C:\Users\eisem\AppData\Local\Programs\Python\Python37-32\lib\site-packages\setuptools\dist.py", line 739, in finalize_options
        ep.load()(self, ep.name, value)
      File "c:\users\eisem\appdata\local\temp\pip-install-afwht5_8\rpy2\.eggs\cffi-1.12.3-py3.7-win32.egg\cffi\setuptools_ext.py", line 217, in cffi_modules
        add_cffi_module(dist, cffi_module)
      File "c:\users\eisem\appdata\local\temp\pip-install-afwht5_8\rpy2\.eggs\cffi-1.12.3-py3.7-win32.egg\cffi\setuptools_ext.py", line 49, in add_cffi_module
        execfile(build_file_name, mod_vars)
      File "c:\users\eisem\appdata\local\temp\pip-install-afwht5_8\rpy2\.eggs\cffi-1.12.3-py3.7-win32.egg\cffi\setuptools_ext.py", line 25, in execfile
        exec(code, glob, glob)
      File "rpy/_rinterface_cffi_build.py", line 546, in <module>
        """ if os.name == 'nt' else ''
      File "c:\users\eisem\appdata\local\temp\pip-install-afwht5_8\rpy2\.eggs\cffi-1.12.3-py3.7-win32.egg\cffi\api.py", line 112, in cdef
        self._cdef(csource, override=override, packed=packed, pack=pack)
      File "c:\users\eisem\appdata\local\temp\pip-install-afwht5_8\rpy2\.eggs\cffi-1.12.3-py3.7-win32.egg\cffi\api.py", line 126, in _cdef
        self._parser.parse(csource, override=override, **options)
      File "c:\users\eisem\appdata\local\temp\pip-install-afwht5_8\rpy2\.eggs\cffi-1.12.3-py3.7-win32.egg\cffi\cparser.py", line 347, in parse
        self._internal_parse(csource)
      File "c:\users\eisem\appdata\local\temp\pip-install-afwht5_8\rpy2\.eggs\cffi-1.12.3-py3.7-win32.egg\cffi\cparser.py", line 352, in _internal_parse
        ast, macros, csource = self._parse(csource)
      File "c:\users\eisem\appdata\local\temp\pip-install-afwht5_8\rpy2\.eggs\cffi-1.12.3-py3.7-win32.egg\cffi\cparser.py", line 296, in _parse
        self.convert_pycparser_error(e, csource)
      File "c:\users\eisem\appdata\local\temp\pip-install-afwht5_8\rpy2\.eggs\cffi-1.12.3-py3.7-win32.egg\cffi\cparser.py", line 325, in convert_pycparser_error
        raise CDefError(msg)
    cffi.CDefError: cannot parse "blah1 ReadConsole;"
    <cdef source string>:23:5: before: blah1
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
----- Fehler beim Installieren von "rpy2==3.0.5" -----

----- "rpy2==3.0.5" wird installiert -----
Collecting rpy2==3.0.5
  Using cached https://files.pythonhosted.org/packages/c7/43/401afad8556bf92b08bd7d422cacac614b0e8dd2bce31848318bbcb18f48/rpy2-3.0.5.tar.gz
    ERROR: Command errored out with exit status 1:
     command: 'C:\Users\eisem\AppData\Local\Programs\Python\Python37-32\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\eisem\\AppData\\Local\\Temp\\pip-install-urxn3u1y\\rpy2\\setup.py'"'"'; __file__='"'"'C:\\Users\\eisem\\AppData\\Local\\Temp\\pip-install-urxn3u1y\\rpy2\\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 pip-egg-info
         cwd: C:\Users\eisem\AppData\Local\Temp\pip-install-urxn3u1y\rpy2\
    Complete output (69 lines):
    warning: no previously-included files found matching 'setup.pyc'
    warning: no previously-included files matching 'yacctab.*' found under directory 'tests'
    warning: no previously-included files matching 'lextab.*' found under directory 'tests'
    warning: no previously-included files matching 'yacctab.*' found under directory 'examples'
    warning: no previously-included files matching 'lextab.*' found under directory 'examples'
    zip_safe flag not set; analyzing archive contents...
    pycparser.ply.__pycache__.lex.cpython-37: module references __file__
    pycparser.ply.__pycache__.lex.cpython-37: module MAY be using inspect.getsourcefile
    pycparser.ply.__pycache__.yacc.cpython-37: module references __file__
    pycparser.ply.__pycache__.yacc.cpython-37: module MAY be using inspect.getsourcefile
    pycparser.ply.__pycache__.yacc.cpython-37: module MAY be using inspect.stack
    pycparser.ply.__pycache__.ygen.cpython-37: module references __file__

    Installed c:\users\eisem\appdata\local\temp\pip-install-urxn3u1y\rpy2\.eggs\pycparser-2.19-py3.7.egg
    Traceback (most recent call last):
      File "c:\users\eisem\appdata\local\temp\pip-install-urxn3u1y\rpy2\.eggs\cffi-1.12.3-py3.7-win32.egg\cffi\cparser.py", line 294, in _parse
        ast = _get_parser().parse(fullcsource)
      File "c:\users\eisem\appdata\local\temp\pip-install-urxn3u1y\rpy2\.eggs\pycparser-2.19-py3.7.egg\pycparser\c_parser.py", line 152, in parse
        debug=debuglevel)
      File "c:\users\eisem\appdata\local\temp\pip-install-urxn3u1y\rpy2\.eggs\pycparser-2.19-py3.7.egg\pycparser\ply\yacc.py", line 331, in parse
        return self.parseopt_notrack(input, lexer, debug, tracking, tokenfunc)
      File "c:\users\eisem\appdata\local\temp\pip-install-urxn3u1y\rpy2\.eggs\pycparser-2.19-py3.7.egg\pycparser\ply\yacc.py", line 1199, in parseopt_notrack
        tok = call_errorfunc(self.errorfunc, errtoken, self)
      File "c:\users\eisem\appdata\local\temp\pip-install-urxn3u1y\rpy2\.eggs\pycparser-2.19-py3.7.egg\pycparser\ply\yacc.py", line 193, in call_errorfunc
        r = errorfunc(token)
      File "c:\users\eisem\appdata\local\temp\pip-install-urxn3u1y\rpy2\.eggs\pycparser-2.19-py3.7.egg\pycparser\c_parser.py", line 1848, in p_error
        column=self.clex.find_tok_column(p)))
      File "c:\users\eisem\appdata\local\temp\pip-install-urxn3u1y\rpy2\.eggs\pycparser-2.19-py3.7.egg\pycparser\plyparser.py", line 67, in _parse_error
        raise ParseError("%s: %s" % (coord, msg))
    pycparser.plyparser.ParseError: <cdef source string>:23:5: before: blah1

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\eisem\AppData\Local\Temp\pip-install-urxn3u1y\rpy2\setup.py", line 184, in <module>
        'rpy2': ['doc/source/rpy2_logo.png', ]}
      File "C:\Users\eisem\AppData\Local\Programs\Python\Python37-32\lib\site-packages\setuptools\__init__.py", line 145, in setup
        return distutils.core.setup(**attrs)
      File "C:\Users\eisem\AppData\Local\Programs\Python\Python37-32\lib\distutils\core.py", line 108, in setup
        _setup_distribution = dist = klass(attrs)
      File "C:\Users\eisem\AppData\Local\Programs\Python\Python37-32\lib\site-packages\setuptools\dist.py", line 447, in __init__
        k: v for k, v in attrs.items()
      File "C:\Users\eisem\AppData\Local\Programs\Python\Python37-32\lib\distutils\dist.py", line 292, in __init__
        self.finalize_options()
      File "C:\Users\eisem\AppData\Local\Programs\Python\Python37-32\lib\site-packages\setuptools\dist.py", line 739, in finalize_options
        ep.load()(self, ep.name, value)
      File "c:\users\eisem\appdata\local\temp\pip-install-urxn3u1y\rpy2\.eggs\cffi-1.12.3-py3.7-win32.egg\cffi\setuptools_ext.py", line 217, in cffi_modules
        add_cffi_module(dist, cffi_module)
      File "c:\users\eisem\appdata\local\temp\pip-install-urxn3u1y\rpy2\.eggs\cffi-1.12.3-py3.7-win32.egg\cffi\setuptools_ext.py", line 49, in add_cffi_module
        execfile(build_file_name, mod_vars)
      File "c:\users\eisem\appdata\local\temp\pip-install-urxn3u1y\rpy2\.eggs\cffi-1.12.3-py3.7-win32.egg\cffi\setuptools_ext.py", line 25, in execfile
        exec(code, glob, glob)
      File "rpy/_rinterface_cffi_build.py", line 546, in <module>
        """ if os.name == 'nt' else ''
      File "c:\users\eisem\appdata\local\temp\pip-install-urxn3u1y\rpy2\.eggs\cffi-1.12.3-py3.7-win32.egg\cffi\api.py", line 112, in cdef
        self._cdef(csource, override=override, packed=packed, pack=pack)
      File "c:\users\eisem\appdata\local\temp\pip-install-urxn3u1y\rpy2\.eggs\cffi-1.12.3-py3.7-win32.egg\cffi\api.py", line 126, in _cdef
        self._parser.parse(csource, override=override, **options)
      File "c:\users\eisem\appdata\local\temp\pip-install-urxn3u1y\rpy2\.eggs\cffi-1.12.3-py3.7-win32.egg\cffi\cparser.py", line 347, in parse
        self._internal_parse(csource)
      File "c:\users\eisem\appdata\local\temp\pip-install-urxn3u1y\rpy2\.eggs\cffi-1.12.3-py3.7-win32.egg\cffi\cparser.py", line 352, in _internal_parse
        ast, macros, csource = self._parse(csource)
      File "c:\users\eisem\appdata\local\temp\pip-install-urxn3u1y\rpy2\.eggs\cffi-1.12.3-py3.7-win32.egg\cffi\cparser.py", line 296, in _parse
        self.convert_pycparser_error(e, csource)
      File "c:\users\eisem\appdata\local\temp\pip-install-urxn3u1y\rpy2\.eggs\cffi-1.12.3-py3.7-win32.egg\cffi\cparser.py", line 325, in convert_pycparser_error
        raise CDefError(msg)
    cffi.CDefError: cannot parse "blah1 ReadConsole;"
    <cdef source string>:23:5: before: blah1
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
----- Fehler beim Installieren von "rpy2==3.0.5" -----

使用 cmd 安装 whl 文件时也会出现此消息。

为什么会出现此消息以及如何安装rpy2Windows 10 上没有任何错误吗?

感谢您的帮助。


None

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

为什么我无法在 Windows 10 上安装适用于 Python 的 rpy2? 的相关文章

  • Python 多处理示例不起作用

    我正在尝试学习如何使用multiprocessing但我无法让它发挥作用 这是代码文档 http docs python org 2 library multiprocessing html from multiprocessing imp
  • 在 R 中使用 lapply 绘制多个数据帧

    我正在尝试使用 lapply 函数绘制多个数据帧 每个数据帧一个图 但是尽管有关此主题的所有帖子我都找不到答案 因为我不断收到错误 图的输出列表为空 我的数据结构如下 df1 lt mtcars gt group by cyl gt tal
  • ggplot2 geom_密度和geom_histogram在一个图中

    如何制作一个所有条形加起来为 1 的直方图 并在适合的上方添加一个密度层 set seed 1234 df lt data frame sex factor rep c F M each 200 weight round c rnorm 2
  • 安装后 Anaconda 提示损坏

    我刚刚安装张量流GPU创建单独的后环境按照以下指示here https github com antoniosehk keras tensorflow windows installation 但是 安装后当我关闭提示窗口并打开新航站楼弹出
  • 从 scikit-learn 导入 make_blobs [重复]

    这个问题在这里已经有答案了 我收到下一个警告 D Programming Python ML venv lib site packages sklearn utils deprecation py 77 DeprecationWarning
  • 如何使用装饰器禁用某些功能的中间件?

    我想模仿的行为csrf exempt see here https docs djangoproject com en 1 11 ref csrf django views decorators csrf csrf exempt and h
  • 在 NumPy 中获取 ndarray 的索引和值

    我有一个 ndarrayA任意维数N 我想创建一个数组B元组 数组或列表 其中第一个N每个元组中的元素是索引 最后一个元素是该索引的值A 例如 A array 1 2 3 4 5 6 Then B 0 0 1 0 1 2 0 2 3 1 0
  • IRichBolt 在storm-1.0.0 和 pyleus-0.3.0 上运行拓扑时出错

    我正在运行风暴拓扑 pyleus verbose local xyz topology jar using storm 1 0 0 pyleus 0 3 0 centos 6 6并得到错误 线程 main java lang NoClass
  • Abaqus 将曲面转化为集合

    我一直试图在模型中找到两个表面的中心 参见照片 但未能成功 它们是元素表面 面 查询中没有选项可以查找元素表面的中心 只能查找元素集的中心 找到节点集的中心也很好 但是我的节点集没有出现在工具 gt 查询 gt 质量属性选项中 而且我找不到
  • 使用 OpenPyXL 迭代工作表和单元格,并使用包含的字符串更新单元格[重复]

    这个问题在这里已经有答案了 我想使用 OpenPyXL 来搜索工作簿 但我遇到了一些问题 希望有人可以帮助解决 以下是一些障碍 待办事项 我的工作表和单元格数量未知 我想搜索工作簿并将工作表名称放入数组中 我想循环遍历每个数组项并搜索包含特
  • 如何将 numpy.matrix 提高到非整数幂?

    The 运算符为numpy matrix不支持非整数幂 gt gt gt m matrix 1 0 0 5 0 5 gt gt gt m 2 5 TypeError exponent must be an integer 我想要的是 oct
  • Numpy 优化

    我有一个根据条件分配值的函数 我的数据集大小通常在 30 50k 范围内 我不确定这是否是使用 numpy 的正确方法 但是当数字超过 5k 时 它会变得非常慢 有没有更好的方法让它更快 import numpy as np N 5000
  • 如何改变Python中特定打印字母的颜色?

    我正在尝试做一个简短的测验 并且想将错误答案显示为红色 欢迎来到我的测验 您想开始吗 是的 祝你好运 法国的首都是哪里 法国 随机答案不正确的答案 我正在尝试将其显示为红色 我的代码是 print Welcome to my Quiz be
  • 通过数据框与函数进行交互

    如果我有这样的日期框架 氮 EG 00 04 NEG 04 08 NEG 08 12 NEG 12 16 NEG 16 20 NEG 20 24 datum von 2017 10 12 21 69 15 36 0 87 1 42 0 76
  • 为美国东部以外地区的 Cloudwatch 警报发送短信?

    AWS 似乎没有为美国东部以外的 SNS 主题订阅者提供 SMS 作为协议 我想连接我的 CloudWatch 警报并在发生故障时接收短信 但无法将其发送到 SMS YES 经过一番挖掘后 我能够让它发挥作用 它比仅仅选择一个主题或输入闹钟
  • 如何在 Django 中使用并发进程记录到单个文件而不使用独占锁

    给定一个在多个服务器上同时执行的 Django 应用程序 该应用程序如何记录到单个共享日志文件 在网络共享中 而不保持该文件以独占模式永久打开 当您想要利用日志流时 这种情况适用于 Windows Azure 网站上托管的 Django 应
  • Python:计算字典的重复值

    我有一本字典如下 dictA unit1 test1 alpha unit1 test2 beta unit2 test1 alpha unit2 test2 gamma unit3 test1 delta unit3 test2 gamm
  • 如何从没有结尾的管道中读取 python 中的 stdin

    当管道来自 打开 时 不知道正确的名称 我无法从 python 中的标准输入或管道读取数据 文件 我有作为例子管道测试 py import sys import time k 0 try for line in sys stdin k k
  • 用于运行可执行文件的python多线程进程

    我正在尝试将一个在 Windows 上运行可执行文件并管理文本输出文件的 python 脚本升级到使用多线程进程的版本 以便我可以利用多个核心 我有四个独立版本的可执行文件 每个线程都知道要访问它们 这部分工作正常 我遇到问题的地方是当它们
  • Python 分析:“‘select.poll’对象的‘poll’方法”是什么?

    我已经使用 python 分析了我的 python 代码cProfile模块并得到以下结果 ncalls tottime percall cumtime percall filename lineno function 13937860 9

随机推荐