1

我是新手 Haskell 用户,想使用 Python 库(用于与现有软件交互,例如使用 Numpy 库)。我发现这可以使用 MissingPy 包(http://hackage.haskell.org/package/MissingPy)来完成,但是我无法在 Haskell 平台 2010.2.0.0 上的 Windows 7 上通过 cabal 安装它。

我遇到的第一个错误是因为编译器没有找到 python2.6 库。这可以通过将 python2.6.dll 放在正确的目录中(或将其添加到系统路径变量中)来解决。但是,我无法在“cabal install missingpy”命令的输出末尾修复以下错误:

...
[11 of 12] Compiling MissingPy.FileArchive.GZip ( MissingPy\FileArchive\GZip.hs, dist\build\MissingPy\FileArchive\GZip.p_o )
[12 of 12] Compiling MissingPy.FileArchive.BZip2 ( MissingPy\FileArchive\BZip2.hs, dist\build\MissingPy\FileArchive\BZip2.p_o )
Registering MissingPy-0.10.5...
setup.exe: MissingPy-0.10.5: library-dirs: None doesn't exist or isn't a
directory (use --force to override)
cabal: Error: some packages failed to install:
MissingPy-0.10.5 failed during the building phase. The exception was:
ExitFailure 1

在阅读了有关在 Windows 上使用 c2hs 上提出的问题的答案的建议后,我安装了完整的 MinGW 软件。然而,这并没有解决问题。

任何人有这个问题的经验和解决方案?

4

1 回答 1

0

请注意,Setup.exe 使用 python 工具填充构建信息:

https://github.com/softmechanics/missingpy/blob/master/Setup.hs

相关代码在这里:

  libDir       <- python ["-c", "from distutils.sysconfig import *; print get_python_lib()"]
  incDir       <- python ["-c", "from distutils.sysconfig import *; print get_python_inc()"]
  confLibDir   <- python ["-c", "from distutils.sysconfig import *; print get_config_var('LIBDIR')"]
  pyVersionStr <- python ["-c", "import sys; sys.stdout.write(\"%d.%d\" % (sys.version_info[0], sys.version_info[1]))"]

如果 python 工具不存在、找不到或提供错误信息,则设置将失败。

于 2013-02-07T16:34:01.957 回答