使用Jupyter Notebook在Cython中进行unordered_set

用户666

我一直在尝试在Mac上的Jupyter Notebook中的Cython中使用unordered_sets。

%%cython -a -3
# distutils: language = c++
# cython: c_string_type=unicode, c_string_encoding=utf8
import cython
from libcpp.unordered_set cimport unordered_set

def test():
    cdef unordered_set[int] s
    return s

上面的单元格抛出: DistutilsExecError: command 'gcc' failed with exit status 1

用户666

最终对我有用的@ead答案的修改版本

使用自制软件(和XCode)更新了GCC,并且以下代码未引发与以前相同的错误。

%%cython -a -3 -c=-stdlib=libc++
# distutils: language = c++

import cython
from libcpp.unordered_set cimport unordered_set

def test():
    cdef unordered_set[int] s
    return s

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章