I'm afraid I don’t know what to do here. I'm a little lost. Google sends me in completely non-local directions.
I just upgraded to Python 3.5 and am now trying to get my current project to work with it. Unfortunately, part of this is done in Cython, and I had to spend the last three days trying to get Python to talk to MinGW. Now I have done this through this patch , but compilation still does not work.
This file compiles flawlessly earlier, so presumably this is something about how Cython is configured.
Here is the full text of the command I give and the error message:
>python setup.py build --compiler=mingw32
running build
running build_ext
building 'fx' extension
C:\mingw\bin\gcc.exe -mdll -O -Wall -IC:\Python35-32\lib\site-packages\numpy\core\include -IC:\Python35-32\include -IC:\Python35-32\include -c fx.c -o build\temp.win32-3.5\Release\fx.o
In file included from C:\Python35-32\include/Python.h:65:0,
from fx.c:12:
C:\Python35-32\include/pytime.h:113:5: warning: 'struct timeval' declared inside parameter list
_PyTime_round_t round);
^
C:\Python35-32\include/pytime.h:118:5: warning: 'struct timeval' declared inside parameter list
_PyTime_round_t round);
^
In file included from C:\Python35-32\lib\site-packages\numpy\core\include/numpy/ndarraytypes.h:1781:0,
from C:\Python35-32\lib\site-packages\numpy\core\include/numpy/ndarrayobject.h:18,
from C:\Python35-32\lib\site-packages\numpy\core\include/numpy/arrayobject.h:4,
from fx.c:250:
C:\Python35-32\lib\site-packages\numpy\core\include/numpy/npy_1_7_deprecated_api.h:12:9: note:
^
writing build\temp.win32-3.5\Release\fx.cp35-win32.def
C:\mingw\bin\gcc.exe -shared -s build\temp.win32-3.5\Release\fx.o build\temp.win32-3.5\Release\fx.cp35-win32.def -LC:\Python35-32\libs -LC:\Python35-32\PCbuild\win32 -lpython35 -lvcruntime140 -o build\lib.win32-3.5\fx.cp35-win32.pyd
c:/mingw/bin/../lib/gcc/mingw32/4.9.3/../../../../mingw32/bin/ld.exe: cannot find -lvcruntime140
collect2.exe: error: ld returned 1 exit status
error: command 'C:\\mingw\\bin\\gcc.exe' failed with exit status 1
#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION fx.c , " ", , Cython API .
setup.py:
from distutils.core import setup
from Cython.Build import cythonize
import numpy
setup(options={'build_ext': {'compiler': 'mingw32'},
"compiler_directives":{"language_level": "3"}},
ext_modules=cythonize("fx.pyx"),
include_dirs=[numpy.get_include()])
, , fx.pyx:
import pygame
cimport numpy
import numpy.random
import random
from libc.stdlib cimport abs
numpy.import_array()
cpdef chromatic_aberration(surface,int intensity=5):
cdef int x,y,z,maxx,maxy
cdef numpy.ndarray[unsigned char,ndim=3] array
cdef numpy.ndarray[unsigned char,ndim=2] r,g,b
r=pygame.surfarray.pixels_red(surface)
g=pygame.surfarray.pixels_green(surface)
b=pygame.surfarray.pixels_blue(surface)
array=pygame.surfarray.pixels3d(surface)
maxx,maxy=surface.get_rect().bottomright
for x in range(maxx):
for y in range(maxy):
try:
pass
array[x,y,0]=r[x+intensity,y]
array[x,y,1]=g[x,y+intensity]
array[x,y,2]=b[x+intensity,y-intensity]
except IndexError:
pass
cpdef mapped_chromatic_aberration(surface, numpy.ndarray[int,ndim=2] intensitymap):
cdef int x,y,z,maxx,maxy,intensity
cdef numpy.ndarray[unsigned char,ndim=3] array
cdef numpy.ndarray[unsigned char,ndim=2] r,g,b
r=pygame.surfarray.pixels_red(surface)
g=pygame.surfarray.pixels_green(surface)
b=pygame.surfarray.pixels_blue(surface)
array=pygame.surfarray.pixels3d(surface)
maxx,maxy=surface.get_rect().bottomright
for x in range(maxx):
for y in range(maxy):
try:
pass
intensity=intensitymap[x,y]
array[x,y,0]=r[x+intensity,y]
array[x,y,1]=g[x,y+intensity]
array[x,y,2]=b[x+intensity,y-intensity]
except IndexError:
pass
cpdef random_chromatic_aberration(surface,int intensity=5):
mapped_chromatic_aberration(surface,numpy.random.random_integers(-intensity,intensity,surface.get_rect().bottomright))
cpdef chroma_warp(surface,int x, int y, int radius, int power):
cdef numpy.ndarray[int,ndim=2] warpmap
warpmap=numpy.zeros(surface.get_size(), dtype=numpy.int)
cdef int maxdist = radius ** 2
cdef int maxx, minx, maxy, miny, warpx, warpy
for xofst in range(-radius, radius):
for yofst in range(-radius, radius):
warpx=x+xofst
warpy=y+yofst
warpmap[warpx,warpy] = ((abs(xofst) + abs(yofst)) * power) // 100
mapped_chromatic_aberration(surface, warpmap)
def screenshake(surf,intensity=3):
surf.scroll(random.randint(-intensity,intensity),random.randint(-intensity,intensity))
build_ext build, .
" , ", , , , . - ?