distutils problem windows xp python 2.4.2

ajikoe at gmail.com ajikoe at gmail.com
Sat Dec 3 19:33:27 EST 2005


Hello I tried to combine c++ and python together.
So I follow from this website:
http://kortis.to/radix/python_ext/

I have this code:
# prmodule.c
static PyObject *pr_isprime(PyObject *self, PyObject *args){
	int n, input;

	if (!PyArg_ParseTuple(args, "i", &input))
	  return NULL;

	if (input < 1) {
		return Py_BuildValue("i", 0);
	}

	n = input - 1;

	while (n > 1){
		if (input%n == 0) return Py_BuildValue("i", 0);;
		n--;
	}

	return Py_BuildValue("i", 1);
}

static PyMethodDef PrMethods[] = {
	{"isprime", pr_isprime, METH_VARARGS, "Check if prime."},
	{NULL, NULL, 0, NULL}
};

void initpr(void){
	(void) Py_InitModule("pr", PrMethods);
}



and my setup.py file:
from distutils.core import setup, Extension
module = Extension('pr', sources = ['prmodule.c'])
setup(name = 'Pr test', version = '1.0', ext_modules = [module])

------------------------------------
If I run setup build
I've got the following error message
running build
running build_ext
error: The .NET Framework SDK needs to be installed before building
extensions for Python.

I use visual Studio 2005.

Thanks,
pujo




More information about the Python-list mailing list