您的位置:首页 > 编程语言 > C语言/C++

简单使用scipy.weave混合使用Python和C++代码的简单例子

2011-06-23 11:52 1041 查看
##########测试环境EPD7.0.2

from scipy.weave import inline
from scipy.weave import converters
def test():
x=list(range(10))
code = """
int i;
for (i=0; i < 10; i++)
{
x[i] = 1;
}
"""
inline(code, ["x"],type_converters=converters.blitz,compiler = 'gcc')
return x
x=test()
print x

####输出信息########################

#Found executable C:/Python27/Scripts/g++.exe
#[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]

####输出信息########################
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: