scipy.weave编译错误没有意义

时间:2015-04-26 20:40:30

标签: python python-2.7 numpy scipy

您好我正在尝试scipy.weave.blitz以使我的代码更快,但它似乎没有工作,只是给出了一个神秘的编译错误。

import numpy as np
from scipy import weave

def algorithm(cities):

    order = np.array( range( cities.shape[0] ) )
    shuffle(order)
    length = calcLength(cities, order)
    start = time()

    changed = True
    while changed:

        changed = False

        for a in range(1, cities.shape[0]):

            for b in range(a+1, cities.shape[0]):

                new_order = np.zeros(order.shape)
                weave.blitz("new_order = order[:a] + order[a:b][::-1] + order[b:]")
                new_length = calcLength(cities, new_order)

                if new_length < length:
                    length = new_length
                    order = new_order
                    changed = True

    return order

和错误

scipy.weave.build_tools.CompileError: error: Command "c++ -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -I/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/scipy/weave -I/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/scipy/weave/scxx -I/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/scipy/weave/blitz -I/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/core/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c /Users/rohan_pandit/.python27_compiled/sc_ef313379710f39f1ed0a26611e4c05775.cpp -o /var/folders/kf/7s4t_81j1hgd5sms0vcd51140000gn/T/rohan_pandit/python27_intermediate/compiler_ce1d2ee8d36678d66289fe8a850c7fbe/Users/rohan_pandit/.python27_compiled/sc_ef313379710f39f1ed0a26611e4c05775.o" failed with exit status 1

很抱歉只是转发错误信息,但我不知道错误:/

0 个答案:

没有答案