【问题标题】:Installing Perl and PDL安装 Perl 和 PDL
【发布时间】:2017-09-06 21:32:06
【问题描述】:

我目前正在尝试 - 未成功安装 perl PDL,因为我想自动执行一些数据分析和图形生成。

不幸的是,我似乎无法毫无问题地安装必要的模块,更不用说创建一个小脚本来处理我的数据文件了。

我对 Perl 有一些初步的经验,但没什么特别的,我使用的是 Windows 10 x64。

最初我选择了 x64 草莓 perl v5.24 安装,然后是 Astro::FITS::Header、Convert::UU、OpenGL 和 PDL 的 ppm 安装 - 按照此处的说明 http://pdl.perl.org/?page=install。但是,安装 Inline::C 存在问题,在尝试了 PDL_Book_Latest http://sourceforge.net/projects/pdl/files/PDL/2.4.10/PDL-Book-20120205.pdf/download 第 5 页上列出的示例之后,没有出现任何图像,也没有图像文件出现在我想搜索的任何位置。回到谷歌,仍然没有找到任何关于这个问题根源的信息,所以我决定回到原点并使用旧版本,希望它会有更好的文档记录。

因此,通过 Windows 安装程序对话框卸载草莓 perl,删除草莓文件夹和包含“草莓”的注册表项。然后使用 Padre IDE v5.14 重新安装 perl - 也许一些调试功能将有助于查明错误。开始安装相同的模块(Astro::FITS::Header、Convert::UU、OpenGL、PGPLOT)。 Astro 和 Convert 工作正常,但 OpenGL 开始抛出关于 ExtUtils::F77 的错误,经过几个小时的搜索,我显然错过了这些错误。我去安装这个模块,它不断给出关于“gfortan”是一个未知命令的错误......我的理解是,PDL 的想法是避免 fortran 和 C,我发现几乎没有关于这个安装问题的信息迄今为止。

所以我决定尝试另一种方法。我从 cpan 安装了 ppm 模块,并通过 ppm 命令重复了初始安装过程。这次我得到:

“在 SOFTPKG 中发现未知元素 'PROVIDE'。位于 C:/Dwimperl/perl/site/lib/PPM.pm 第 1462 行。”

所以我的问题如下:

我是否错过了安装过程中的一些关键步骤?我的系统是否真的处理得很糟糕,如果是这样,是否有任何可能的解决方法?我尝试了两个不同的版本是否会导致路径问题成为问题的根源?

谁能提供一种替代方法,最好不要太复杂的路线来在 Windows 10 上使用给定的 perl 安装来安装 PDL?

编辑 1:

这是我在尝试安装 Inline::C 时遇到的错误代码,这是 PDL 的明显先决条件

code deleted to make space for updates...

编辑 3:

我在PATH指定的目录中重新安装了GnuWin32,而不是更改PATH,然后再次尝试安装。 Inline::C 给出了相同的 'diff' 和 'rm' 错误。所以我运行“cpanm --notest 'package'”来安装 Inline::C 然后 PDL,都说他们成功了。但是,即使使用 '--notest' cpanm 也无法安装 OpenGL 和 PGPLOT。

最终目标是能够使用 PGPLOT 中的函数生成图形:例如

# use PDL;
# use PDL::Graphics::PGPLOT;
# imag(sin(rvals(200,200)+1));

但如果 PGPLOT 无法安装,这当然不起作用。

编辑 4:

尝试了 @Dr.Avalange 在 sourceforge https://sourceforge.net/p/pogl/bugs/26/ 找到的修复程序,并注意到我似乎有这个文件的多个副本。

Here

这正常吗...?

编辑 5: 所以我卸载了 perl,删除了我可以在 %APPDATA%、%USERPROFILE% 和 C:/DWIM 中找到的所有挥之不去的文件,然后运行 ​​ccleaner 以防我错过任何东西。

然后我下载了 Strawberry perl 5.24.1 x64 for Windows 并安装了它。

之后,我按照http://pdl.perl.org/?page=install 运行了'cpanm Astro::FITS::Header'、cpanm 'Convert-UU' 和'cpanm OpenGL'。这一切都很好。然后我运行“cpanm PDL”,它安装了 Inline、Pegex、Win32::Mutex 和 Module::Compile 依赖项。但是,如果与您之前提到的 Inline::C 有相同的错误。

我之前已经安装了 GetGnuWin32,所以不知道为什么这不起作用。 Windows 'Path' 环境(不是 PATH - 根据高级系统对话框,它不存在)标记为

%USERPROFILE%\AppData\Local\Microsoft\WindowsApps; 在这个目录中,我有 GetGnuWin32 文件夹,它应该已经安装了您提供的链接中的所有软件包,除非我错过了正确安装它的补充步骤?所以我重新下载了 DiffUtils 设置并运行它,安装到 \programfiles(x86) (默认选项)。然后我重新运行“cpanm PDL”。

我仍然收到相同的“差异”错误消息。那么 DiffUtils 是否安装不正确? (我确实在尝试之间和安装后关闭并重新打开了命令行)

编辑 6:

因此,在使用 --notest 安装 PDL 和 PGPLOT 后,我尝试运行以下测试,但失败了。见下文

C:\Windows\system32>perldl
perlDL shell v1.357
 PDL comes with ABSOLUTELY NO WARRANTY. For details, see the file
 'COPYING' in the PDL distribution. This is free software and you
 are welcome to redistribute it under certain conditions, see
 the same file for details.
ReadLines, NiceSlice, MultiLines  enabled
Reading PDL/default.pdl...
Found docs database C:/Strawberry/perl/site/lib/PDL/pdldoc.db
Type 'help' for online help
Type 'demo' for online demos
Loaded PDL v2.017 (supports bad values)

Note: AutoLoader not enabled ('use PDL::AutoLoader' recommended)

                                                                                                                        pdl> use PDL::Graphics//PLplot
Unknown regexp modifier "/P" at (eval 62) line 4, at end of line
Unknown regexp modifier "/L" at (eval 62) line 4, at end of line
Unknown regexp modifier "/t" at (eval 62) line 4, at end of line
BEGIN not safe after errors--compilation aborted at (eval 62) line 5, <DATA> line 207.

                                                                                                                        pdl> use PDL::Graphics::PLplot
Can't locate PDL/Graphics/PLplot.pm in @INC (you may need to install the PDL::Graphics::PLplot module) (@INC contains: C:/Strawberry/perl/site/lib/MSWin32-x64-multi-thread C:/Strawberry/perl/site/lib C:/Strawberry/perl/vendor/lib C:/Strawberry/perl/lib .) at (eval 72) line 5.
BEGIN failed--compilation aborted

                                                                                                                        pdl> use PDL

                                                                                                                        pdl> use lib 'C:/Strawberry/perl/site/lib/PDL/Graphics'

                                                                                                                        pdl> use PGPLOT

                                                                                                                        pdl> use PDL::Graphics::PGPLOT

                                                                                                                        pdl> imag(sin(rvals(200,200)+1))
Undefined subroutine &PDL::Graphics::PGPLOT::pgqinf called at C:/Strawberry/perl/site/lib/PDL/Graphics/PGPLOT.pm line 408, <DATA> line 90.

                                                                                                                        pdl> exit

C:\Windows\system32>cpanm PDL::Graphics::PGPLOT::pgqinf
! Finding PDL::Graphics::PGPLOT::pgqinf on cpanmetadb failed.
! Finding PDL::Graphics::PGPLOT::pgqinf () on mirror http://www.cpan.org failed.
! Couldn't find module or a distribution PDL::Graphics::PGPLOT::pgqinf

C:\Windows\system32>cpan PDL::Graphics::PGPLOT::pgqinf
Loading internal null logger. Install Log::Log4perl for logging messages
CPAN: CPAN::SQLite loaded ok (v0.211)
Database was generated on Thu, 13 Apr 2017 13:49:14 GMT


C:\Windows\system32>

已经存在目录问题,但我设法将其指向我认为的正确方向。还尝试安装 PLplot 'cpanm' 表示安装成功但没有 .pm 文件,在另一个目录中只有一个 .pd ,因此使用 PDL::Graphics::PLplot 失败,因为找不到 .pm 文件。

编辑:7 所以这次重试ppm install http://www.sisyphusion.tk/ppm/PGPLOT.ppd似乎有效,因为您提供的解释中的链接不再使用 http://www.kalinabears.com.au/w32perl/pgplot-5.2.2-mingw32.tar.bz2 http://jrfonseca.home.dyndns.org/projects/gnu-win32/software/ported/patches/pgplot-5.2.2-mingw32.diff.gz 虽然这似乎可行,但没有列出安装所需文件的痕迹,除非它们只是用于这种特定方法?

pgplot/bin/cpgplot.dll
pgplot/bin/pgplot.dll
pgplot/bin/grfont.dat
pgplot/include/cpgplot.h
pgplot/lib/cpgplot.a
pgplot/lib/pgplot.a

最后,再次尝试该示例会得到以下结果;没有错误,但也没有图像...

Microsoft Windows [version 10.0.14393]
(c) 2016 Microsoft Corporation. Tous droits réservés.

C:\Windows\system32>perldl
perlDL shell v1.357
 PDL comes with ABSOLUTELY NO WARRANTY. For details, see the file
 'COPYING' in the PDL distribution. This is free software and you
 are welcome to redistribute it under certain conditions, see
 the same file for details.
ReadLines, NiceSlice, MultiLines  enabled
Reading PDL/default.pdl...
Found docs database C:/Strawberry/perl/site/lib/PDL/pdldoc.db
Type 'help' for online help
Type 'demo' for online demos
Loaded PDL v2.017 (supports bad values)

Note: AutoLoader not enabled ('use PDL::AutoLoader' recommended)

pdl> use PDL

pdl> use PDL::Graphics::PGPLOT

pdl> imag(rvals(200,200)+1)
 %PGPLOT, Unable to read font file: grfont.dat
 %PGPLOT, Use environment variable PGPLOT_FONT to specify the location of the PGPLOT grfont.dat file.
Displaying 200 x 200 image from 1 to 142.421356201172, using 240 colors (16-255)...

pdl> $ENV{PGPLOT_FONT} = "C:/Strawberry/perl/site/lib/PGPLOT/pgplot_supp"

pdl> imag(rvals(200,200)+1)
Displaying 200 x 200 image from 1 to 142.421356201172, using 240 colors (16-255)...

pdl>

【问题讨论】:

  • "但是,安装 Inline::C 时出现了问题" 什么问题?显示发生了什么
  • @Dr.Avalanche 它一直为 dmake 提供 255 错误,其中一项测试见编辑。

标签: windows perl failed-installation pdl


【解决方案1】:

从法语翻译后,我可以看到您的系统中没有diff。要么安装 diff(gnu32 的一部分:http://gnuwin32.sourceforge.net/),要么直接跳过测试。另见:

https://github.com/ingydotnet/inline-c-pm/issues/60

使用 Strawberry 5.24.1 只需在命令提示符下键入以下内容:

cpanm --notest PDL

或者如果您想观看正在发生的一切:

cpanm -v --notest PDL

这需要一些时间来运行。

【讨论】:

  • 所以我下载了 GetGnuWin32-0.6.3 并将其安装到 C:/GnuWin23。重新运行 cpan -f Inline::C 并且仍然得到相同的 'diff' 和 'rm' 未知命令错误。是否有我应该选择的特定安装位置,或者我是否需要取消 PATH 变量的日期?
  • 另外,PGPLOT 和 OpenGL 也失败了,我的安装可能有问题吗?我以前从未遇到过正确安装模块的麻烦......
  • @NzFrancis 嗨,您需要将安装这些程序的路径添加到 Windows PATH 环境变量中(请看这里:java.com/en/download/help/path.xml)。如果您使用 UI 执行此操作,则需要关闭并启动新的命令提示符,然后更改才会生效。请注意cpanmcpan 快得多,还请注意我建议尝试使用--notest。这些模块很复杂并且依赖于第三方工具。我只能回答具体问题
  • 感谢您迄今为止的帮助。我更改了安装目录以匹配 PATH 目录,但仍然出现相同的错误,即使使用“--notetest”仍然无法安装 OpenGL 和 PGPLOT。见编辑 3。
  • @NzFrancis 关于 OpenGL,这里有一个修复:sourceforge.net/p/pogl/bugs/26
猜你喜欢
  • 2012-02-19
  • 2019-07-12
  • 2012-06-12
  • 2016-09-16
  • 2019-07-13
  • 1970-01-01
  • 2020-06-16
  • 2014-02-21
  • 2012-01-24
相关资源
最近更新 更多