Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where is 'pyximport'?

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?

like image 873
orome Avatar asked Oct 19 '15 19:10

orome


People also ask

What is Pyximport?

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.


1 Answers

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.

like image 124
Andrew Walker Avatar answered Sep 17 '22 14:09

Andrew Walker