[英]Has anyone managed to create plots with PDL using the PDL edition of Strawberry Perl 5.30.1.1 on Windows?
有沒有人設法在 Windows 上使用 Strawberry Perl 的 PDL 版本用 PDL(Perl 數據語言)創建繪圖?
我從http://strawberryperl.com/releases.html在 Windows 10(64 位)上安裝了 Strawberry Perl 5.30.1.1 的 PDL 版本,啟動了 PDL (pdl2),並嘗試顯示 plot 中的第一個示例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 被檢測到,但顯然無法滿足一些額外的要求。
所以看起來 Windows 上的草莓 Perl 5.30.1.1 附帶的 gnuplot 版本不適合 PDL 使用,即使 Alien::Gnuplot 問題已修復——但隨機用戶(我)似乎很奇怪) 應該是第一個注意到這一點的人。 還是我做錯了什么?
我在https://rt.cpan.org/Ticket/Display.html?id=131361報告了這個明顯的錯誤,但我對 Windows 上其他用戶使用此版本的體驗感興趣。
編輯 2020-01-10 : https://pdl.perl.org說 Strawberry 的 PDL 版本 Perl 是在 Windows 上安裝 PDL 的“絕對最簡單的方法”,並且沒有提到任何其他需要安裝的東西.
它還提到了一種“替代簡單方法”,其中涉及顯式安裝 PGPLOT,它是 PDL 嘗試使用的其他圖形引擎之一。
言下之意是“絕對最簡單的方法”不需要額外的工作來安裝圖形引擎,但我的經驗是不同的。
我的問題不是“我還需要安裝哪些其他東西才能使我的 PDL 能夠使用圖形引擎?”。 我想知道它是否可以開箱即用,正如“絕對最簡單的方法”所暗示的那樣。
不幸的是,在撰寫本文時,對 Windows 的 PDL 圖形支持有些薄弱。 demo 3d
命令有效(演示PDL::Graphics::TriD
),但PDL::Graphics::Simple
支持的各種圖形驅動程序,正如您所注意到的,在各種方面功能不足。
好消息是,正在采取措施糾正這個問題 - 例如,請參閱Alien::PLplot
,旨在允許在 Windows 上安裝 PLplot。如果您想提供幫助,請參閱各種模塊的 GitHub 頁面以了解當前跟蹤的問題(或者通過編碼、測試,甚至只是報告特定問題):
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.