Cannot get Cython to find the MinGW gcc compiler even after editing PATH by creating a file in distutils, deleting all instances of -mno-cygwin

I am trying to understand that I have a c-compiler in MinGW 32-bit, and I tried everything I can find on the Internet, but it still does not work. I am using the 64-bit version of Windows 7 Professional. Here is what I tried:

(1) I have Python 2.7, and I just installed MinGW with the gcc and g ++ options and some other options

(2) I edited the PATH environment variable, so it included

C:\MinGW\bin;C:\MinGW\MSYS\1.0\local\bin;C:\MinGW\MSYS\1.0\bin 

(3) I told Python to use MinGW as the default compiler by creating a file called

C: \ Python27 \ Lib \ distutils \ distutils.cfg containing

 [build] compiler = mingw32 

(By the way, I have MinGW32)

(4) I deleted all instances of -mno-cygwin from C: \ Python27 \ Lib \ distutils \ cygwincompiler.py

(5) I have a setup.py file and a module called trycython.pyx written in python. My setup.py says from setting import distutils.core import from distutils.extension import Extension from Cython.Distutils import build_ext

 setup( cmdclass = {'build_ext':build_ext}, ext_modules=[Extension("tryingcython",["tryingcython.pyx"])] ) 

So, I open the command line and get into the directory containing setup.py and trycython.pyx, and I print python setup.py build_ext --inplace --compiler = mingw32

Then he tells me:

 running build_ext skipping 'tryingcython.c' Cython extension (up-to-date) building 'tryingcython.c' extension gcc -mdll -O -Wall -IC:\Python27\include -IC:\Python27\PC -c tryingcython.c -o build\ temp.win32-2.7\Release\tryingcython.o error: command 'gcc' failed: No such file or directory 

So, I think Cython cannot say that I have gcc, and it cannot find it or that, although I have tried all the tips that I can find on the Internet to understand that I have MinGW, which is Enabled by gcc . Any help / additional ideas on how I can make it really work on the cython will be greatly appreciated.

+4
source share
1 answer

You are using the exact same operating system and version as me.

Try cal gcc with:

 SET input=intput.c SET output=output.pyd gcc -shared -IC:\Python27\include -LC:\Python27\libs -O2 -o %output% %input% -lpython27 

Usually I put this call in the cythongcc.bat file in the directory recognized by the PATH environment variable, like:

 gcc -shared -IC:\Python27\include -LC:\Python27\libs -O3 -mtune=native -o %1.pyd %2.c -lpython27 

So that I can, where are my cython .pyx files .pyx , just do:

 cython input.pyx cythongcc input input 

To compile compiled .pyd !

0
source

Source: https://habr.com/ru/post/1492989/


All Articles