------------------ ???????? ------------------ ??????: "KaShining";<mail2sh...@qq.com>; ????????: 2013??11??4??(??????) ????4:13 ??????: "Armin Rigo"<ar...@tunes.org>; ????: "pypy-dev"<pypy-dev@python.org>; ????: Re: [pypy-dev] pypy about c-extension
+++++++++++++++++++ addressbook.proto package tutorial; message Person { required string name = 1; required int32 id = 2; optional string email = 3; enum PhoneType { MOBILE = 0; HOME = 1; WORK = 2; } message PhoneNumber { required string number = 1; optional PhoneType type = 2 [default = HOME]; } repeated PhoneNumber phone = 4; } message AddressBook { repeated Person person = 1; } /usr/local/bin/protoc -I=./ --cpp_out=./ ./addressbook.proto gen addressboo.pb.h and addressboo.pb.cc addressbook.c?? #include <Python.h> static PyMethodDef podMethods[] = { {NULL, NULL, 0, NULL} /* Sentinel */ }; PyMODINIT_FUNC initpodpb(void) { PyObject *m; m = Py_InitModule("podpb", podMethods); if (m == NULL) return; } setup.py import os import platform from setuptools import setup, find_packages from distutils.core import setup, Extension setup( ext_modules=[Extension('podpb', sources=['./addressbook.c','./addressbook.pb.cc'], libraries=['protobuf'])] ) python setup.py build gen build/lib.linux-x86_64-2.7/podpbpypy.so then in my test.py import podpbpypy throw err: ImportError: No module named podpbpypy ------------------ Original ------------------ From: "Armin Rigo";<ar...@tunes.org>; Date: Mon, Nov 4, 2013 04:08 PM To: "KaShining"<mail2sh...@qq.com>; Cc: "pypy-dev"<pypy-dev@python.org>; Subject: Re: [pypy-dev] pypy about c-extension Hi, On Mon, Nov 4, 2013 at 9:04 AM, KaShining <mail2sh...@qq.com> wrote: > import podpbpypy > ImportError: No module named podpbpypy > > seen can't find podpbpypy.so There is no point repeating what you already said. I'm asking, how did you build the .so in the first place. Armin
protobuf.pypy.tar.gz
Description: Binary data
_______________________________________________ pypy-dev mailing list pypy-dev@python.org https://mail.python.org/mailman/listinfo/pypy-dev