Wrapping C++ Standard library with Cython in ipython

后端 未结 2 2008
旧时难觅i
旧时难觅i 2020-12-21 13:48

According to the Cython documentation ,I write the following cython code as follows:

In [1]:%load_ext Cython
In [2]: %%cython
         from libcpp.vector c         


        
2条回答
  •  隐瞒了意图╮
    2020-12-21 13:51

    As an alternative to @romeric's answer, the documentation for ipython Cython magic suggests using

    %%cython --cplus
    

    to turn on C++ mode. Help for the command can also be accessed by running %%cython? in the IPython console.

    Personally I think there's a lot to be said for using the distutils comment approach, since it links the language with the code that requires it.

提交回复
热议问题