pyyolo icon indicating copy to clipboard operation
pyyolo copied to clipboard

python3

Open stvogel opened this issue 7 years ago • 3 comments

I think pyyolo is currently build for python2. As I wanted to use it with python3, I had to make a few changes.

I'm not really used to git-pull-request I simply paste my changes here. Maybe it helps someone. I just added this in module.c (instead of initpyyolo):

static struct PyModuleDef cModPyYolo =
{
        PyModuleDef_HEAD_INIT,
        "pyyolo",
        "",
        -1,
        PyyoloMethods
};
PyMODINIT_FUNC PyInit_pyyolo(void)
{
        return PyModule_Create(&cModPyYolo);
}

stvogel avatar May 25 '17 10:05 stvogel

Your changes can build in python3 but not python2. Also python3 cannot import cv2 in example.py. Do you have any good idea?

Thanks,

digitalbrain79 avatar May 26 '17 05:05 digitalbrain79

You are right. That was a python3-only solution

#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef cModPyYolo =
{
        PyModuleDef_HEAD_INIT,
        "pyyolo",
        "",
        -1,
        PyyoloMethods
};
PyMODINIT_FUNC PyInit_pyyolo(void)
{
        return PyModule_Create(&cModPyYolo);
}

#else
PyMODINIT_FUNC initpyyolo(void)
{
...
}
#endif

This works for me (only tested on python3, though). And by the way, when I build without CUDNN the libraries: 'cuda', 'cudart', 'cublas', 'curand', 'cudnn' must be removed in setup.py

stvogel avatar May 26 '17 12:05 stvogel

I modified module.c. But I'm not familiar with the setup.py script. Could you add CUDA option in setup.py?

Thanks,

digitalbrain79 avatar May 29 '17 00:05 digitalbrain79