![](/img/trans.png)
[英]Problems with building OpenCV 3.2 and python bindings on Windows
[英]Building FANN Python bindings under Windows
我已经为python 2.7编译了fann。
您可以从这里下载: https : //github.com/jacekm-git/pyfann_python2.7_windows
cd c:\fann\python\pyfann\
swig -c++ -python pyfann.i
SWIGINTERN PyObject *_wrap_training_data_parent_create_train_from_callback(PyObject*SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
FANN::training_data *arg1 = (FANN::training_data *) 0 ;
unsigned int arg2 ;
unsigned int arg3 ;
unsigned int arg4 ;
void (*arg5)(unsigned int,unsigned int,unsigned int,fann_type *,fann_type *) = (void (*)(unsigned int,unsigned int,unsigned int,fann_type *,fann_type *)) 0 ;
// .... rest of file ...
改成:
typedef void (__stdcall *arg5_fn)(unsigned int, unsigned int, unsigned int, fann_type*, fann_type*); // added line
SWIGINTERN PyObject *_wrap_training_data_parent_create_train_from_callback(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
FANN::training_data *arg1 = (FANN::training_data *) 0 ;
unsigned int arg2 ;
unsigned int arg3 ;
unsigned int arg4 ;
/* void (*arg5)(unsigned int,unsigned int,unsigned int,fann_type *,fann_type *) = (void (*)(unsigned int,unsigned int,unsigned int,fann_type *,fann_type *)) 0 ;*/
arg5_fn arg5= (arg5_fn)NULL; // added line
// ....
# swig_cmd = 'swig -c++ -python pyfann/pyfann.i'
# print 'Running SWIG before:', swig_cmd
# os.system(swig_cmd)
ext_modules=[Extension('pyfann._libfann',['pyfann/pyfann_wrap.cxx'],
include_dirs=['../src/include'],
# extra_objects=['../src/doublefann.o'],
libraries = ['pyfann/fanndoubled'],
define_macros=[("SWIG_COMPILE",None)]
),
cd C:\fann\python\
python setup.py install
copy C:\fann\python\pyfann\fanndoubled.dll C:\Python27\Lib\site-packages\pyfann\
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.