安装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 ...
随机推荐
- RS码的突发纠错能力
RS码便于纠突发错误.所谓突发错误,是指burst errors. 即一长串连续位出错.例如 0011XXXX1010. 其中X表示出错.如果是GF(2^4)中定义的RS码,则可以由一个符号错误纠正. ...
- std_msgs/String.msg
from std_msgs.msg import String http://docs.ros.org/api/std_msgs/html/msg/String.html
- [CTF]CTF中if (md5(md5($_GET[‘a’])) == md5($_GET[‘b’])) 的绕过
原作者:KTWO 出处:https://www.k2zone.cn/?p=2019 0X00 摘要 CTF中md5判等可使用0e绕过,但是如果是双md5该如何绕过呢?本文将教你如何绕过md5(md5( ...
- NoSql数据库Redis系列(4)——Redis数据持久化(AOF)
上一篇文章我们介绍了Redis的RDB持久化,RDB 持久化存在一个缺点是一定时间内做一次备份,如果redis意外down掉的话,就会丢失最后一次快照后的所有修改(数据有丢失).对于数据完整性要求很严 ...
- arcpy显示指定表的索引属性
import arcpy feature_class = "c:/data/well.shp" # Create a list of indexes using the ListI ...
- C# ffmpeg 视频处理格式转换具体案例
C# ffmpeg 视频处理格式转换 C# ffmpeg 视频处理格式转换avi到MP4格式 1.代码如下: using System;using System.Diagnostics; namesp ...
- MiniUI表单验证实践
学习实践: <form id="form2"> <div id="update_pas" style="width:380px&qu ...
- Flutter -------- Http库 网络请求封装(HttpController)
http库 再次封装的网络请求类 HttpController 1.添加依赖 dependencies: http: ^0.12.0 #latest version 2.导入库 import 'pac ...
- Tomcat connection & session timeout settings
# connection timeout for globle web application cat /home/soft/apache-tomcat-7.0.92/conf/server.xml ...
- Python判断是否是闰年
year = 2012 if year % 100 != 0 and year % 4 == 0: print('闰年') elif year % 100 == 0 and year % 400 == ...