安装rpy2 报错<cdef source string>:23:5: before: blah1 解决办法就是直接下载一个rpy2的轮子
win7上安装rpy2, python环境是3.6.1。
使用pip install rpy2直接安装rpy2,对应的版本时rpy2 3.0.5
报如下错误:
ERROR: Complete output from command python setup.py egg_info:
ERROR: Traceback (most recent call last):
File "d:\python_virtualenv\pandas0192\lib\site-packages\cffi\cparser.py", line 276, in _parse
ast = _get_parser().parse(fullcsource)
File "d:\python_virtualenv\pandas0192\lib\site-packages\pycparser\c_parser.py", line 152, in parse
debug=debuglevel)
File "d:\python_virtualenv\pandas0192\lib\site-packages\pycparser\ply\yacc.py", line 331, in parse
return self.parseopt_notrack(input, lexer, debug, tracking, tokenfunc)
File "d:\python_virtualenv\pandas0192\lib\site-packages\pycparser\ply\yacc.py", line 1199, in parseopt_notrack
tok = call_errorfunc(self.errorfunc, errtoken, self)
File "d:\python_virtualenv\pandas0192\lib\site-packages\pycparser\ply\yacc.py", line 193, in call_errorfunc
r = errorfunc(token)
File "d:\python_virtualenv\pandas0192\lib\site-packages\pycparser\c_parser.py", line 1761, in p_error
column=self.clex.find_tok_column(p)))
File "d:\python_virtualenv\pandas0192\lib\site-packages\pycparser\plyparser.py", line 66, 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\ADMINI~1\AppData\Local\Temp\pip-install-n564fvky\rpy2\setup.py", line 184, in <module>
'rpy2': ['doc/source/rpy2_logo.png', ]}
File "d:\python_virtualenv\pandas0192\lib\site-packages\setuptools\__init__.py", line 131, in setup
return distutils.core.setup(**attrs)
File "d:\program files\python361\Lib\distutils\core.py", line 108, in setup
_setup_distribution = dist = klass(attrs)
File "d:\python_virtualenv\pandas0192\lib\site-packages\setuptools\dist.py", line 370, in __init__
k: v for k, v in attrs.items()
File "d:\program files\python361\Lib\distutils\dist.py", line 281, in __init__
self.finalize_options()
File "d:\python_virtualenv\pandas0192\lib\site-packages\setuptools\dist.py", line 529, in finalize_options
ep.load()(self, ep.name, value)
File "d:\python_virtualenv\pandas0192\lib\site-packages\cffi\setuptools_ext.py", line 204, in cffi_modules
add_cffi_module(dist, cffi_module)
File "d:\python_virtualenv\pandas0192\lib\site-packages\cffi\setuptools_ext.py", line 49, in add_cffi_module
execfile(build_file_name, mod_vars)
File "d:\python_virtualenv\pandas0192\lib\site-packages\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 "d:\python_virtualenv\pandas0192\lib\site-packages\cffi\api.py", line 107, in cdef
self._cdef(csource, override=override, packed=packed)
File "d:\python_virtualenv\pandas0192\lib\site-packages\cffi\api.py", line 121, in _cdef
self._parser.parse(csource, override=override, **options)
File "d:\python_virtualenv\pandas0192\lib\site-packages\cffi\cparser.py", line 315, in parse
self._internal_parse(csource)
File "d:\python_virtualenv\pandas0192\lib\site-packages\cffi\cparser.py", line 320, in _internal_parse
ast, macros, csource = self._parse(csource)
File "d:\python_virtualenv\pandas0192\lib\site-packages\cffi\cparser.py", line 278, in _parse
self.convert_pycparser_error(e, csource)
File "d:\python_virtualenv\pandas0192\lib\site-packages\cffi\cparser.py", line 307, in convert_pycparser_error
raise CDefError(msg)
cffi.error.CDefError: cannot parse "blah1 ReadConsole;"
<cdef source string>:23:5: before: blah1
----------------------------------------
ERROR: Command "python setup.py egg_info" failed with error code 1 in C:\Users\ADMINI~1\AppData\Local\Temp\pip-install-n564fvky\rpy2\
报错的大概意思是blah1 ReadConsole;这句话无法执行, 查看文件_rinterface_cffi_build.py,发现blah1这个类的定义在_rinterface_cffi_build.py文件中并没有。
在rpy2的最新的开源代码中,_rinterface_cffi_build.py文件中是有关于 "blah1"这个的定义的。源码网站地址: https://bitbucket.org/rpy2/rpy2/src/default/rpy/_rinterface_cffi_build.py
源码上是这样写的:
if os.name == 'nt':
ffibuilder.cdef("""
typedef int (*blah1) (const char *, char *, int, int);
typedef void (*blah2) (const char *, int);
typedef void (*blah3) (void);
typedef void (*blah4) (const char *);
/* Return value here is expected to be 1 for Yes, -1 for No and
* 0 for Cancel: symbolic constants in graphapp.h */
typedef int (*blah5) (const char *);
typedef void (*blah6) (int);
typedef void (*blah7) (const char *, int, int);
typedef enum {RGui, RTerm, LinkDLL} UImode; """)
然后我试了把开源代码直接下载下来,然后使用python setup.py install方式安装,rpy2这回可以正常安装上了。
然后检查一下可不可以使用:
>>> import rpy2
>>> from rpy2.robjects.packages import importr
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<frozen importlib._bootstrap>", line 961, in _find_and_load
File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 646, in _load_unlocked
File "<frozen importlib._bootstrap>", line 616, in _load_backward_compatible
File "D:\python_virtualenv\nlp_learn\lib\site-packages\rpy2-3.1.0.dev0-py3.6.egg\rpy2\robjects\__init__.py", line 14, in <module>
File "<frozen importlib._bootstrap>", line 961, in _find_and_load
File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 646, in _load_unlocked
File "<frozen importlib._bootstrap>", line 616, in _load_backward_compatible
File "D:\python_virtualenv\nlp_learn\lib\site-packages\rpy2-3.1.0.dev0-py3.6.egg\rpy2\rinterface.py", line 5, in <module>
File "<frozen importlib._bootstrap>", line 961, in _find_and_load
File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 646, in _load_unlocked
File "<frozen importlib._bootstrap>", line 616, in _load_backward_compatible
File "D:\python_virtualenv\nlp_learn\lib\site-packages\rpy2-3.1.0.dev0-py3.6.egg\rpy2\rinterface_lib\openrlib.py", line 21, in <module>
File "D:\python_virtualenv\nlp_learn\lib\site-packages\rpy2-3.1.0.dev0-py3.6.egg\rpy2\rinterface_lib\openrlib.py", line 16, in _dlopen_rlib
File "D:\python_virtualenv\nlp_learn\lib\site-packages\rpy2-3.1.0.dev0-py3.6.egg\rpy2\situation.py", line 71, in get_rlib_path
ValueError: The system "%s" is not supported.
得,(¬_¬),这意思是不支持当前的系统。
找了一个rpy2的文档,文档上是这么说的:
Microsoft’s Windows - unofficial and unsupported binaries are provided by Christoph Gohlke (http://www.lfd.uci.edu/~gohlke/pythonlibs/); there is otherwise currently close to no support for this platform
文档地址: https://rpy2.github.io/doc/latest/html/overview.html#installation
就是说rpy2不支持windows这个平台,如果想要使用,请到https://www.lfd.uci.edu/~gohlke/pythonlibs/网站上去下载一个编译好的轮子。
这个网站上rpy2的最新版本是2.9.5, 选择好要下载的版本,选择好对应的系统, 下载完成后直接使用pip install + 轮子名称即可。
问题解决,早知道我直接去下个轮子就好了,还看了半天源码,浪费时间!!!
安装rpy2 报错<cdef source string>:23:5: before: blah1 解决办法就是直接下载一个rpy2的轮子的更多相关文章
- Scrapy安装报错 Microsoft Visual C++ 14.0 is required 解决办法
Scrapy安装报错 Microsoft Visual C++ 14.0 is required 解决办法原因:Scrapy需要的组 twisted 需要 C++环境编译. 方法一:根据错误提示去对应 ...
- CocoaPods pod install的时候报错:invalid byte sequence in UTF-8 (ArgumentError)解决办法
CocoaPods pod install的时候报错:invalid byte sequence in UTF-8 (ArgumentError)解决办法: 基本可以确定是Podfile中的内容编码有 ...
- 转 : Apache启动报错:could not bind to address [::]:443 解决办法
转:Apache启动报错:could not bind to address [::]:443 解决办法 安装Apache服务器的时候,报如下错误: Installing the 'apache' s ...
- excel第一次打开报错 向程序发送命令时出错 多种解决办法含终极解决方法
excel第一次打开报错 向程序发送命令时出错 多种解决办法含终极解决方法 office2007应该遇到“向程序发送命令时出现 问题”,设置为以管理员运行也不好用,重装office也不好用,下面介绍下 ...
- adb shell报错:error: insufficient permissions for device的解决办法
1.错误描述 执行 adb shell 时,报错如下; error: insufficient permissions for device 2.解决办法 1,终端执行 lsusb 结果如下,注意绿 ...
- Win7 64bit 安装VisualSVN出现报错:Servic 'VisualSVN Server' failed to start.解决办法
问题描述: Win7 64bit 安装VisualSVN时出现报错: Servic 'VisualSVN Server' failed to start.Please check VisualSVN ...
- java开发过程中,报错Dangling meta character '*' near index 0,解决办法
1.split方法转化字符串为数组: String[] strPicArr = map.get("hw_pic").toString().split("*"); ...
- (转)PyCharm报错:“No R interpreter defined: Many R……”——解决办法
报错截图: 下载安装链接:The Comprehensive R Archive Network
- Mac 升级后idea执行git命令报错xcrun: error: invalid active developer path的解决办法
报错 xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun ...
随机推荐
- [golang][vue] 前后端分离、微服务架构等等---通用后台权限管理系统001
emmm暂未开源,先上图.其实有很多东东都未完成,一步一步来吧 这里是大图 这里会有二维码的,暂未写完哈 注册界面 后台 测试地址 测试地址al.landv.pw:88 测试账号:admin 测试密码 ...
- Codeforces 1172D. Nauuo and Portals 构造
原文链接www.cnblogs.com/zhouzhendong/p/CF1172D.html 前言 明哥神仙打cf方式真潇洒.45分钟切D后就不打了? 我当场爆肝D想错方向不会做自闭了. 题解 考虑 ...
- Docker hello workd
Docker 允许你在容器内运行应用程序, 使用 docker run 命令来在容器内运行一个应用程序. 输出Hello world runoob@runoob:~$ docker run ubunt ...
- 【Vue.js游戏机实战】- Vue.js实现九宫格水果机抽奖游戏总结
大家好!先上图看看本次案例的整体效果. 完整版实战课程附源码:[Vue.js游戏机实战]- Vue.js实现九宫格水果机抽奖 实现思路: Vue component实现九宫格水果机组件,可以嵌套到任意 ...
- 如何画好ER图
快速阅读 了解ER图的基本组成,以及如何在viso中画ER图. 什么是ER图 是实体关系图,用矩形表示实体,用椭圆形表示属性,用棱形表示两实体之间的联系.相互用直接联接起来,是一种数据建模工具.用来描 ...
- U盘量产过程PS2251-07(PS2307) - F/W 01.05.10 [2014-05-23]
说明本篇文章可能无法解决你的问题,请谨慎尝试.本博客中使用的工具提供下载(如果没有积分,可联系作者免费获取)ChipGenius_v4_00_0030UPTool_v2.089起因 U盘原先正常使用, ...
- win10 'make' 不是内部或外部命令
win10 解决“ 'g++' 不是内部或外部命令,也不是可运行的程序或批处理文件”的问题 https://www.jianshu.com/p/9bffbaf12bed windows下提示make不 ...
- P1310 表达式的值
P1310 表达式的值 题解 1.假设有两个布尔变量 x , y x0表示使得x=0的方案数 x1表示使得x=1的方案数 y0表示使得y=0的方案数 y1表示使得y=1的方案数 | 按位或 & ...
- 扩展和嵌入 Python 解释器 用 C 或 C++ 编写模块以使用新模块来扩展 Python 解释器的功能 定义新的函数\对象类型\方法。 将 Python 解释器嵌入到另一个应用程序中
// https://python3-cookbook.readthedocs.io/zh_CN/latest/c15/p02_write_simple_c_extension_module.html ...
- Faster, more memory efficient and more ordered dictionaries on PyPy
Faster, more memory efficient and more ordered dictionaries on PyPy https://morepypy.blogspot.com/20 ...