+ 1

Problem with compiling by Cython

Hi, i dont see the error in my code. looks for me like normal loop. https://code.sololearn.com/cA0A12a153A1

16th Jul 2021, 8:22 AM
Oma Falk
Oma Falk - avatar
5 Respostas
+ 2
After creating setup.py it works fine (for me on termux app), here it gives an error saying gcc command failed. import os os.system("pip3 -q install Cython") import cython with open("hellooma.pyx","w+") as f: f.write('def fib(n):\n\ta, b = 0, 1\n\twhile b < n:\r\t\tprint(b)\n\ta, b = b, a + b') with open("setup.py","w") as f: f.write('from setuptools import setup\nfrom Cython.Build import cythonize\nsetup(ext_modules=cythonize("hellooma.pyx",compiler_directives={"language_level" : "3"} ) )') os.system('python setup.py build_ext --inplace') import hellooma print(hellooma.fib(7))
16th Jul 2021, 11:54 AM
Abhay
Abhay - avatar
+ 2
If I remove the end=" " from print, the error msg changes to a FutureWarning. It seems to try to use a Python 2. Is that any informative?
16th Jul 2021, 8:33 AM
Lisa
Lisa - avatar
+ 2
Lisa thats it you, 🧠🧠
16th Jul 2021, 11:41 AM
Oma Falk
Oma Falk - avatar
+ 2
thanks to all! Finally it wont work here, because a c- Compiler is missing
17th Jul 2021, 5:42 AM
Oma Falk
Oma Falk - avatar
+ 1
line 14: expected ")" found "="
16th Jul 2021, 8:31 AM
Shadoff
Shadoff - avatar