我正在使用 CFFI 从 Python 中使用 OpenMP 调用 C 函数。我的代码在我的一台计算机上运行,但在另一台计算机上运行非常相似。
import os
from cffi import FFI
# test
os.system("gcc -fopenmp -c test.c -o test.o")
os.system("gcc -o test.exe test.o -fopenmp")
os.system("test.exe")
# gateway
ffi = FFI()
os.system("gcc -o test.so test.c -shared -fopenmp")
ffi.cdef(r''' int main(); ''')
lib = ffi.dlopen(r'''test.so''')
lib.main()
错误是
OSError: cannot load library test.so: error 0x45a
我正在使用 Python 3.5(最新的 Anaconda 发行版)和 TDM-GCC 5.1.0。测试在两台计算机上运行。什么可以解释不同的行为?