我有一个非常简单的 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',],),]
)