【问题标题】:matplotlib error while installing pyspeckit安装 pyspeckit 时出现 matplotlib 错误
【发布时间】:2013-09-01 16:03:13
【问题描述】:

在尝试下载 Pyspeckit(一个天文学程序)时,我需要获取 matplotlib 才能使其工作。但是,当我尝试安装 matplotlib 时,cygwin 给了我错误:

In file included from lib/matplotlib/tri/_tri.cpp:8:0:
lib/matplotlib/tri/_tri.h:821:33: error: expected unqualified-id before numeric constant
lib/matplotlib/tri/_tri.cpp: In constructor ‘RandomNumberGenerator::RandomNumberGenerator(long unsigned int)’:
lib/matplotlib/tri/_tri.cpp:2180:28: error: expected identifier before numeric constant
lib/matplotlib/tri/_tri.cpp:2180:28: error: expected ‘{’ before numeric constant
lib/matplotlib/tri/_tri.cpp: At global scope:
lib/matplotlib/tri/_tri.cpp:2180:28: error: expected unqualified-id before numeric constant
error: command 'gcc' failed with exit status 1

所以我想知道是否有人可以解决这个问题?我通过 Cygwin 使用 python 2.7.3,所以使用安装程序 exe 不起作用。

如果没有,是否可以指出我如何从 cygwin 中访问类似 canopy 的东西,因为 canopy 或类似的包已经预装了 matplotlib?

感谢您的宝贵时间。

【问题讨论】:

  • 这些只是 gcc 编译器错误,因此 C++ 代码中可能存在 gcc 无法理解的内容。尝试查看它说是错误的代码行,如果仍然无法得到它,请使用 C++ 标记发布问题。

标签: python windows gcc matplotlib cygwin


【解决方案1】:

我在 Cygwin 上使用 matplotlib 时遇到了同样的问题。

在第 821 行的 lib/matplotlib/tri/_tri.h 中定义了一个名为“_C”的变量,并在第 2180 和 2186 行的 tri.cpp 中调用。出于某种原因 gcc 不喜欢这样(它是某些架构中的保留字?)。我刚刚在 tri.h 和 tri.cpp 中将变量重命名为“_Co”,编译成功完成。

【讨论】:

  • 这是否导致任何功能损失或什么?
  • 或者你的意思是所有用途的一致重命名?如果是这样,它是否仅在该类内部引用?
  • 没有功能损失。是的,重命名所有用途(这只是我提到的三个)。是的,我相信它只是在内部引用。
【解决方案2】:

该问题已在以下工单中处理:

https://github.com/matplotlib/matplotlib/issues/2463

【讨论】:

    猜你喜欢
    • 2016-12-05
    • 2021-02-20
    • 2023-03-03
    • 1970-01-01
    • 2020-02-15
    • 1970-01-01
    • 2012-10-06
    • 2021-02-07
    相关资源
    最近更新 更多