小编Wil*_*man的帖子

Nyaplot 在 jupyterhub 中运行的 iruby 中不生成绘图

我正在尝试在现有的多用户 jupyterhub 安装中设置 Ruby 内核。它在我的所有测试中都有效,除了由 nyaplot (我能找到的唯一在 iruby 中工作的绘图包)创建的绘图不会显示在笔记本中。例如,以下代码(来自 Nyaplot 教程之一)没有给出错误(甚至在 syslog 文件中也没有),但没有绘图:

require 'nyaplot'
plot = Nyaplot::Plot.new
sc = plot.add(:scatter, [0,1,2,3,4], [-1,2,-3,4,-5])
color = Nyaplot::Colors.qual
sc.color(color)
plot.show # show plot on IRuby notebook
Run Code Online (Sandbox Code Playgroud)

背景:

以下是我如何设置 iruby 在 jupyterhub 中运行。我提供整个过程,以便 (a) 您可以发现是否缺少任何内容,以及 (b) 这样您就知道,如果您说“将 [this] 添加到 Gemfile”之类的内容,您将必须告诉我在哪里放置 Gemfile,因为 jupyterhub 没有在特定目录外运行 iruby。

操作系统是CentOS 7.3。由于其默认的 ruby​​ 版本太旧,无法运行 iruby,我使用 ruby​​-install 安装了一个版本的 ruby​​:

wget -O ruby-install-0.6.1.tar.gz https://github.com/postmodern/ruby-install/archive/v0.6.1.tar.gz
tar -xzvf ruby-install-0.6.1.tar.gz 
cd ruby-install-0.6.1
make
make install
ruby-install ruby 2.3.4
Run Code Online (Sandbox Code Playgroud)

(我使用了 ruby​​ 2.3,而不是 2.4,因为事实证明 sciruby-full 至少有一个组件还不能与 …

ruby graphics centos7 iruby jupyterhub

5
推荐指数
1
解决办法
322
查看次数

标签 统计

centos7 ×1

graphics ×1

iruby ×1

jupyterhub ×1

ruby ×1