首页 > 解决方案 > 有没有人设法在 Windows 上使用 PDL 版本的 Strawberry Perl 5.30.1.1 使用 PDL 创建绘图?

问题描述

有没有人设法在 Windows 上使用 PDL 版本的草莓 Perl 使用 PDL(Perl 数据语言)创建绘图?

我在 Windows 10(64 位)上从http://strawberryperl.com/releases.html安装了 Strawberry Perl 5.30.1.1 的 PDL 版本,启动了 PDL(pdl2),并尝试显示第一个示例中描述的绘图PDL 书(2015 年版):

pdl> use PDL::Graphics::Simple
pdl> imag (sin(rvals(200,200)+1))

但得到了

Trying gnuplot (PDL::Graphics::Gnuplot)...nope
Trying pgplot (PDL::Graphics::PGPLOT::Window)...nope
Trying plplot (PDL::Graphics::PLplot)...nope
Trying prima (PDL::Graphics::Prima)...nope
Runtime error: Sorry, all known plotting engines failed.  Install one and try again.

即使 gnuplot 5.2 patchlevel 6 包含在 Strawberry Perl 的那个版本中。

由于 Alien::Gnuplot v1.033 中的问题,我发现 PDL 未检测到 gnuplot。如果我将 Alien::Gnuplot::load_gnuplot 的 Windows 特定部分更改为

if($^O =~ /MSWin32/i) {

  if( $exec_path =~ m/([\"\*\?\<\>\|])/ ) {
    die "Alien::Gnuplot: Invalid character '$1' in path to gnuplot -- I give up" ;
  }

  use Win32::Job;
  my $job = Win32::Job->new;
  open my $ofh, ">$file";
  if (defined $ofh) {
    my $pid = $job->spawn(undef, qq{"$exec_path" ${file}_gzinta},
                          { no_window => 1, stdout => $ofh, stderr => $ofh });
    if (defined $pid) {
      $job->run(3); # wait at most 3 seconds for job to finish
    }
  }
}

然后运行 ​​PDL 示例产生:

Trying gnuplot (PDL::Graphics::Gnuplot)...PDL::Graphics::SImple: Gnuplot exists but yours doesn't support either the x11 or wxt terminal
Trying pgplot (PDL::Graphics::PGPLOT::Window)...nope
Trying plplot (PDL::Graphics::PLplot)...nope
Trying prima (PDL::Graphics::Prima)...nope
Runtime error: Sorry, all known plotting engines failed.  Install one and try again.

所以然后检测到gnuplot,但显然无法满足一些额外的要求。

因此,即使解决了 Alien::Gnuplot 问题,Windows 上的草莓 Perl 5.30.1.1 的 PDL 版附带的 gnuplot 版本似乎也不适合 PDL 使用——但随机用户(我) 应该是第一个注意到这一点的人。还是我做错了什么?

我在https://rt.cpan.org/Ticket/Display.html?id=131361报告了这个明显的错误,但我对其他用户在 Windows 上使用此版本的体验感兴趣。

编辑 2020-01-10https ://pdl.perl.org说草莓 Perl 的 PDL 版本是在 Windows 上安装 PDL 的“绝对最简单的方法”,并且没有提到其他需要安装的东西.

它还提到了一种“替代简单方法”,其中涉及显式安装 PGPLOT,这是 PDL 尝试使用的其他图形引擎之一。

言外之意是“绝对最简单的方式”不需要额外的工作来安装图形引擎,但我的经验是不同的。

我的问题不是“我还需要安装哪些其他东西才能使我的 PDL 使用图形引擎?”。我想知道它是否可以开箱即用,正如“绝对最简单的方法”所暗示的那样。

标签: windowsperlpdl

解决方案


推荐阅读