I have some (not so) old code in which I use pyximport
, but the code fails right at
import pyximport; pyximport.install()
with
ImportError: No module named pyximport
I've made a few changes to my system since I last ran this code, so perhaps it was removed or not migrated; but I can't find this package anywhere and
pip search pyximport
yields no results.
What happened to pyximport
? Where can I find it and, failing that, what should I use instead?
pyximport is part of Cython, and it's used in place of import in a way. If your module doesn't require any extra C libraries or a special build setup, then you can use the pyximport module to load .pyx files directly on import, without having to write a setup.py file.
pyximport is a part of cython.
$ pip install cython
You can find the description of it here. In short, pyximport provides an import hook which allows you to import cython files (and compile them) as though they were python.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With