【问题标题】:Build Python 2.7.12 on a Mac with Intel compiler使用 Intel 编译器在 Mac 上构建 Python 2.7.12
【发布时间】:2017-02-01 01:46:20
【问题描述】:

我一直在尝试使用英特尔编译器套件 (Intel Parallel Studio) 在我的 Mac 上从源代码构建 Python,并将其与英特尔的 MKL 链接。 原因是我想在我的 mac 上使用与我们的 linux 集群上完全相同的环境来开发 Python 代码。

只要我不告诉配置脚本使用英特尔的并行工作室,Python 就可以正常构建(配置和制作:./configure --with(out)-gcc)。但是,一旦我将--with-icc 包含在内,或者如果我将./configure --help 中提到的适当环境变量设置为英特尔编译器和链接器,make 就会失败:

icc -c -fno-strict-aliasing -fp-model strict -g -O2 -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -I. -IInclude -I./Include -DPy_BUILD_CORE -o Python/getcompiler.o Python/getcompiler.c

Python/getcompiler.c(27): error: expected a ";" return COMPILER; ^

compilation aborted for Python/getcompiler.c (code 2) make: *** [Python/getcompiler.o] Error 2

我到处搜索,但似乎没有人对在带有英特尔编译器的 mac 上构建 Python 感兴趣,或者我是唯一一个遇到问题的人。我还根据 Intel 的说明配置了我的环境:source /opt/intel/bin/compilervars.sh intel64, in ~/.bash_profile

无论如何,我的环境是:

  • OS X 10.11.6
  • Xcode 8.1 / 构建版本 8B62
  • 英特尔 Parallel Studio XE 2017.0.036(C/C++、Fortran)

谢谢, 弗朗索瓦

【问题讨论】:

    标签: macos python-2.7 build intel


    【解决方案1】:

    您可以在getcompiler.c 中编辑它抱怨的行:

    例如到

    return "[Intel compiler]";

    如果您想变得更高级,可以添加编译器版本,例如使用__INTEL_COMPILER 宏。

    【讨论】:

      猜你喜欢
      • 2016-12-06
      • 2021-06-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-10-20
      • 1970-01-01
      • 1970-01-01
      • 2010-11-06
      相关资源
      最近更新 更多