首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >python rpy2.ipython不工作-找不到模块(操作系统:%load_ext mint 17 |R 3.1.2 |python 2.7.6 | ipython notebook 2.3.1 | rpy2 2.5.2)

python rpy2.ipython不工作-找不到模块(操作系统:%load_ext mint 17 |R 3.1.2 |python 2.7.6 | ipython notebook 2.3.1 | rpy2 2.5.2)
EN

Stack Overflow用户
提问于 2014-11-29 03:58:59
回答 2查看 4.1K关注 0票数 0

在Ipython notebook上使用%R magic时遇到问题。

执行以下命令

%load_ext rpy2.ipython

'ImportError: No moduled named ipython'中的结果

代码语言:javascript
复制
  ---------------------------------------------------------------------------
 ImportError                               Traceback (most recent call last)
 <ipython-input-18-691c6d73b073> in <module>()
 ----> 1 get_ipython().magic(u'load_ext rpy2.ipython')
 
 /usr/local/lib/python2.7/dist-packages/IPython/core/interactiveshell.pyc in magic(self, arg_s)
    2203         magic_name, _, magic_arg_s = arg_s.partition(' ')
    2204         magic_name = magic_name.lstrip(prefilter.ESC_MAGIC)
 -> 2205         return self.run_line_magic(magic_name, magic_arg_s)
    2206 
    2207     #-------------------------------------------------------------------------
 
 /usr/local/lib/python2.7/dist-packages/IPython/core/interactiveshell.pyc in run_line_magic(self, magic_name, line)
    2124                 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
    2125             with self.builtin_trap:
 -> 2126                 result = fn(*args,**kwargs)
    2127             return result
    2128 
 
 /usr/local/lib/python2.7/dist-packages/IPython/core/magics/extension.pyc in load_ext(self, module_str)
 
 /usr/local/lib/python2.7/dist-packages/IPython/core/magic.pyc in <lambda>(f, *a, **k)
     191     # but it's overkill for just that one bit of state.
     192     def magic_deco(arg):
 --> 193         call = lambda f, *a, **k: f(*a, **k)
     194 
     195         if callable(arg):
 
 /usr/local/lib/python2.7/dist-packages/IPython/core/magics/extension.pyc in load_ext(self, module_str)
      61         if not module_str:
      62             raise UsageError('Missing module name.')
 ---> 63         res = self.shell.extension_manager.load_extension(module_str)
      64 
      65         if res == 'already loaded':
 
 /usr/local/lib/python2.7/dist-packages/IPython/core/extensions.pyc in load_extension(self, module_str)
      96             if module_str not in sys.modules:
      97                 with prepended_to_syspath(self.ipython_extension_dir):
 ---> 98                     __import__(module_str)
      99             mod = sys.modules[module_str]
     100             if self._call_load_ipython_extension(mod):
 
 ImportError: No module named ipython

有可能是什么问题的线索吗?

谢谢

编辑: 2016年6月1日

导入语句也丢失

导入rpy2.ipython

%load_ext rpy2.ipython

EN

回答 2

Stack Overflow用户

发布于 2018-09-30 07:40:58

尝试:

$ conda install -c r r-essentials

然后:

$ conda install -c r rpy2

考虑使用conda而不是pip__安装此上下文上的任何依赖项。

票数 1
EN

Stack Overflow用户

发布于 2017-01-18 01:31:58

在启动笔记本之前,您是否尝试过在命令行窗口中键入命令activate root

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/27195203

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档