0

I'm quite new to python and to coding in general, so apologize for possible silly questions.

My problem is that I wrote a code in python and since it was extremely slow I have tryed to use cython to speed it up. So at the moment I want to import a module called test_cython.C in a .py file, but using import I'm getting this error (ModuleNotFoundError: No module named 'test_cython')... do you have any suggestion on how to solve this problem? or more in generale how to import a C module in python?

nicola
  • 29
  • 2
  • Does this answer your question? [Can we use C code in Python?](https://stackoverflow.com/questions/18762621/can-we-use-c-code-in-python) – Gino Mempin Feb 26 '21 at 11:21
  • As for the ModuleNotFoundError, you will have to provide a [mcve] of your code that shows the problem. – Gino Mempin Feb 26 '21 at 11:22
  • See https://cython.readthedocs.io/en/latest/src/quickstart/build.html, it looks like you aren't building your extension. – ead Feb 26 '21 at 12:51

1 Answers1

0

To use a c file you need to compile the C code first and then use the compiled file in your code. Check out this link:http://book.pythontips.com/en/latest/python_c_extension.html