0

I've just begun to learn cython, and I have not found any good command or instruction by googling. I've tried those commands:

gcc -shared -pthread -fPIC -fwrapv -O2 -Wall -fno-strict-aliasing \                                                                                           1 ⨯
      -I/usr/include/python3.5 -o rrrattack.cpython-39-x86_64-linux-gnu.so rrrattack.c
cythonize -a -i yourmod.pyx

cythonize gives me .so file, gcc returns error ""python.h" does not exists". What I do not such as a way?

Super mix
  • 1
  • 1
  • You specified `/usr/include/python3.5` as include path, but perhaps that path doesn't exist? – CherryDT Apr 26 '22 at 22:12
  • @CherryDT I've changed it to path where I have my Python 3.9. Problem stays same – Super mix Apr 26 '22 at 22:16
  • 1
    Are you sure you have your Python _headers_ there? – CherryDT Apr 26 '22 at 22:17
  • No. Maybe, try my Py2.7? – Super mix Apr 26 '22 at 22:18
  • @CherryDT tried. mypyxcode.c0D - no such file or directory – Super mix Apr 26 '22 at 22:20
  • I mean, maybe you didn't install the `-dev` package for your Python but only the binaries? It sounds to me like you are now trying to point the include path to the path where your Python binaries live and not where your Python headers live (if you even have them installed). – CherryDT Apr 26 '22 at 22:23
  • Does this answer your question? [I have Python on my Ubuntu system, but gcc can't find Python.h](https://stackoverflow.com/questions/8282231/i-have-python-on-my-ubuntu-system-but-gcc-cant-find-python-h) – CherryDT Apr 26 '22 at 22:23
  • Does `ls /usr/include/python3.9 | grep Python` (change it to whatever include path you used) give anything? – Eric Jin Apr 26 '22 at 22:25
  • @CherryDT `gcc -shared -pthread -fPIC -fwrapv -O2 -Wall -fno-strict-aliasing \ -I/usr/bin/python3.9 | grep Python -o rrrattack.cpython-39-x86_64-linux-gnu.so rrrattack.c ` returns `grep: rrrattack.cpython-39-x86_64-linux-gnu.so: двійковий файл містить збіжність rrrattack.c:Python rrrattack.c:Python rrrattack.c:Python rrrattack.c:Python rrrattack.c:Python rrrattack.c:Python rrrattack.c:Python gcc: fatal error: no input files compilation terminated. ` – Super mix Apr 26 '22 at 22:34
  • @Supermix Why did you put `grep` in there? Eric Jin asked you to run `ls /usr/include/python3.9 | grep Python` in particular, not to randomly include `| grep Python` in your GCC command line. Also, again, I see you pointed it towards the directory with your Python _binaries_ and not _headers_, this can't work. Please make sure you installed the relevant package for your distribution that contains the Python headers (probably `python3.9-dev`) and then use the correct include path (probably `/usr/include/python3.9`). – CherryDT Apr 26 '22 at 22:40

0 Answers0