python - 用/openmp编译的模块无法导入?

标签 python python-2.7 openmp cython

我有一个非常简单的 cython 代码,它使用 prange,它在 Linux 中运行良好。但是,当我尝试在 Windows 中执行此操作时。我遇到了可以编译但无法导入的问题:

ImportError: DLL load failed: This application has failed to start because the a
pplication configuration is incorrect. Reinstalling the application may fix this
problem.

此外,在 Windows 中我无法 from cython.parallel import threadlocal?!奇怪...

有谁可以指点一下吗?

系统工作正常:linux64,编译器gcc,软件包:Python 2.7,cython 0.16

系统有问题:Win64,编译器:MSVC VS2008,软件包:Python 2.7、cython 0.16

这是我的简单 cython pyx:

cimport cython
from cython.parallel import prange

def f(int n):
    cdef int i
    cdef int sum = 0
    for i in prange(n, nogil=True):
        sum += i
    print sum

这是我的 setup.py:

from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
import numpy as np


setup(
    cmdclass = {'build_ext': build_ext},
    include_dirs = [np.get_include()], 
    ext_modules = [Extension("pcython1",  ["pcython1.pyx"],extra_compile_args=['/openmp',],),]
)

最佳答案

由于 VS2008 安装程序错误,amd64_microsoft.vc90.openMP 无法安装到 winSxS 中。安装openMP运行时将解决这个问题。

有关详细信息,请参阅此问题:How to properly setup VS2008 for x64 programing?

关于python - 用/openmp编译的模块无法导入?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11778824/

相关文章:

python - 限制从 Pandas 中的数据框显示的最大列数

python - 在python中制作完整的矩阵输出

c++ - 如何在 OS X 10.9 上编译 C++ 程序并在以前的 OS X 版本上使用?

python - 使用 RSA 算法进行编码解码时图像数据被损坏

python - 正确地为 c 包装器制作 setup.py

python-2.7 - pyrMeanShiftFiltering中的颜色窗口半径是什么意思?

c++ - Microsoft Visual C++ 的 OpenMP 更新,仍然停留在版本 2 上

c++ - 如何区分预处理器和编译器指令?

python - Python 的神经网络库?

Python 2.7 : Print to File