How do I import function from .pyx file in python?
程序员文章站
2022-04-24 14:19:38
...
question:
I'm trying to run Hadoopy, which has a file _main.pyx, and import
_main
is failing with module not found in __init__.py.
I'm trying to run this on OS X w/ standard python 2.7.
solution:
Add this code before you try to import _main
:
import pyximport
pyximport.install()
Note that pyximport
is
part of Cython,
so you'll have to install that if it isn't already.