Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22037

How to use Cython on Windows 10 with python 3.8

$
0
0

I want to know how correctly convert py documents to C with help Cython But all the time a have some error.

D:\Cython\test4>python setup.py build_ext --inplace
running build_ext
Traceback (most recent call last):
  File "setup.py", line 4, in <module>
    setup(ext_modules = cythonize('hello.pyx', compiler_directives={'language_level': 3}))
  File "C:\Users\Alexandr\AppData\Local\Programs\Python\Python38\lib\distutils\core.py", line 148, in setup
    dist.run_commands()
  File "C:\Users\Alexandr\AppData\Local\Programs\Python\Python38\lib\distutils\dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "C:\Users\Alexandr\AppData\Local\Programs\Python\Python38\lib\distutils\dist.py", line 985, in run_command
    cmd_obj.run()
  File "C:\Users\Alexandr\AppData\Local\Programs\Python\Python38\lib\distutils\command\build_ext.py", line 306, in run
    self.compiler = new_compiler(compiler=self.compiler,
  File "C:\Users\Alexandr\AppData\Local\Programs\Python\Python38\lib\distutils\ccompiler.py", line 1032, in new_compiler
    return klass(None, dry_run, force)
  File "C:\Users\Alexandr\AppData\Local\Programs\Python\Python38\lib\distutils\cygwinccompiler.py", line 282, in __init__
    CygwinCCompiler.__init__ (self, verbose, dry_run, force)
  File "C:\Users\Alexandr\AppData\Local\Programs\Python\Python38\lib\distutils\cygwinccompiler.py", line 157, in __init__
    self.dll_libraries = get_msvcr()
  File "C:\Users\Alexandr\AppData\Local\Programs\Python\Python38\lib\distutils\cygwinccompiler.py", line 86, in get_msvcr
    raise ValueError("Unknown MS Compiler version %s " % msc_ver)
ValueError: Unknown MS Compiler version 1916

I have hello.pyx file, which includes this code

cpdef int test(int x):
    cdef int y = 1
    cdef int i
    for i in range(1, x+1):
        y *= i
    return y

Setup.py file includes

   from distutils.core import setup 
   from Cython.Build import cythonize
   setup(ext_modules = cythonize('hello.pyx', compiler_directives={'language_level': 3}))

Microsoft Visual Studio has installed, gcc compiler also installed. What should I do?


Viewing all articles
Browse latest Browse all 22037

Trending Articles