+ 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
5 Réponses
+ 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))
+ 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?
+ 2
Lisa thats it you, 🧠🧠
+ 2
thanks to all!
Finally it wont work here, because a c- Compiler is missing
+ 1
line 14:
expected ")"
found "="