cython3: Cannot start!

Paulo da Silva p_s_d_a_s_i_l_v_a_ns at
Sat Dec 22 13:26:29 EST 2018

Sorry if this is OT.

I decided to give cython a try and cannot run a very simple program!

1. I am using kubuntu 18.04 and installe cython3 (not cython).

2. My program tp.pyx:

# cython: language_level=3

from distutils.core import setup
from Cython.Build import cythonize

    ext_modules = cythonize("tp.pyx")

4. Running it:
python3 build_ext --inplace
python3 -c 'import tp'

5. output:
('Test', 2)

This is wrong for python3! It should output
Test 2

It seems that it is parsing tp.pyx as a python2 script!

I tried to change the print to python2
print "Test",2

and it recognizes the syntax and outputs
Test 2

So, how can I tell cython to use python3?

Thanks for any help/comments

More information about the Python-list mailing list