cython - Extending Python 3.5 (Windows) with C++ -


my goal have ability call functions in c++ meaningful arguments.

i can't subprocess.call because go main(int argc,char** argv) , have bunch of strings deal with. not want have parse matrices out of strings.

i'm trying use cython because seems reasonable thing do. although there amount of guides getting cython running of them 2.7, , it's rare see 2 advise same thing.

my question here know how cython running on py3.5? or know of guide or something? i'm lost.

okay had pretty silly mistake, compiling msvs, spent so time trying mingw work forget that, 'msvc' trick. passersby if you're on 3.5+ should using visual studio 2015. after installing cython 'pip3 install cython', create setup.py file put this

from distutils.core import setup cython.build import cythonize  setup(ext_modules = cythonize(        "testcython.pyx",                 # our cython source        #sources=["rectangle.cpp"],  # additional source file(s)        language="c++",             # generate c++ code   )) 

create .pyx file (let's 'testcython.pyx') write whatever want example (let's 'print("hello world")'. sources argument cythonize optional.

then cd .pyx , .py file , run
'python setup.py build_ext --inplace --compiler=msvc'

this should compile .cpp , .pyd file (the latter 1 use). if had hello world printed out import testcython.

refer docs , google else. ;)


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -