【问题标题】:Errors while installing matplotlib on OS X 10.8在 OS X 10.8 上安装 matplotlib 时出错
【发布时间】:2014-04-25 06:49:48
【问题描述】:

我正在尝试在装有 OS X 10.8 和 XCode 5.0.2 的机器上安装 matplotlib。我得到了这些我无法理解的奇怪错误。我使用pip install matplotlib 安装包,但最后它返回以下错误。我不知道该怎么做。请帮我继续。我尝试通过相同的过程安装 scipy,并且出现相同的错误流。

building 'rootfind' library

compiling C sources

C compiler: clang -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe



creating build/temp.macosx-10.8-intel-2.7/scipy/optimize/Zeros

compile options: '-I/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/core/include -c'

clang: scipy/optimize/Zeros/bisect.c

clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future]

clang: note: this will be a hard error (cannot be downgraded to a warning) in the future

clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future]

clang: note: this will be a hard error (cannot be downgraded to a warning) in the future

error: Command "clang -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -I/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/core/include -c scipy/optimize/Zeros/bisect.c -o build/temp.macosx-10.8-intel-2.7/scipy/optimize/Zeros/bisect.o" failed with exit status 1

----------------------------------------
Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/private/var/folders/v3/xf03tznj5hn9mj7j_4jbkvw40000gn/T/pip_build_Siva/scipy/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/v3/xf03tznj5hn9mj7j_4jbkvw40000gn/T/pip-u0HK_Y-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /private/var/folders/v3/xf03tznj5hn9mj7j_4jbkvw40000gn/T/pip_build_Siva/scipy

在此之后,我将ARCHFLAGS 变量设置为以下

export ARCHFLAGS='-Wno-error=unused-command-line-argument-hard-error-in-future'

虽然安装过程进行得更进一步,但我现在在不同的位置收到错误流。

running build_ext

building 'matplotlib.ft2font' extension

creating build/temp.macosx-10.8-intel-2.7

creating build/temp.macosx-10.8-intel-2.7/src

creating build/temp.macosx-10.8-intel-2.7/CXX

clang -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wshorten-64-to-32 -DNDEBUG -g -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -DPY_ARRAY_UNIQUE_SYMBOL=MPL_matplotlib_ft2font_ARRAY_API -DPYCXX_ISO_CPP_LIB=1 -I/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/core/include -I/usr/local/include -I/usr/include -I. -I/usr/local/Cellar/freetype/2.5.3_1/include/freetype2 -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/ft2font.cpp -o build/temp.macosx-10.8-intel-2.7/src/ft2font.o

clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future]

clang: note: this will be a hard error (cannot be downgraded to a warning) in the future

error: command 'clang' failed with exit status 1

----------------------------------------
Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/private/tmp/pip_build_root/matplotlib/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-ZU81yE-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /private/tmp/pip_build_root/matplotlib

【问题讨论】:

    标签: python matplotlib scipy clang osx-mountain-lion


    【解决方案1】:

    这是一个常见问题,最近的 macos 更新使 clang 生成错误而不是对未知编译器选项的警告。作为临时解决方法,您可以在运行 pip 之前设置 ARCHFLAGS 环境变量:

    export ARCHFLAGS='-Wno-error=unused-command-line-argument-hard-error-in-future'
    

    【讨论】:

    • 虽然它继续前进了一点,但在我设置了你所说的标志后,我仍然得到同样的错误。我已经用新的错误更新了问题。
    • 正如@psl 所建议的,我使用以下方法设置了ARCHFLAGS 变量并且它起作用了。 sudo ARCHFLAGS="-Wno-error=unused-command-line-argument-hard-error-in-future" pip install matplotlib [stackoverflow.com/a/23022901/1468760][1]
    【解决方案2】:

    我更喜欢在 OS X 上使用 Canopy 作为 Python 环境,因为在 Mac 上安装 Python 包通常比较困难。

    你可以在这里得到它:https://www.enthought.com/downloads/

    MatPlotLib 是默认安装的,安装 Canopy 后更多的包更容易安装。

    【讨论】:

    • 我正在尝试为另一个包 ROS - 机器人操作系统安装 matplotlib。由于 matplotlib 是其包之一的依赖项。如果我安装 Canopy,它会为此服务吗?
    猜你喜欢
    • 1970-01-01
    • 2013-07-19
    • 2013-07-12
    • 1970-01-01
    • 2013-01-02
    • 2014-03-23
    • 2013-05-05
    • 2016-07-22
    • 1970-01-01
    相关资源
    最近更新 更多