cythonを使いたくて
python setup.py build_ext --inplace
を実行するが
エラーがでてしまいます
開発環境はanaconda python3.6.1 windows10です
python
1python setup.py build_ext --inplace 2 3------------------------------------------------------- 4実行結果 5 6running build_ext 7skipping 'cythonfn.c' Cython extension (up-to-date) 8building 'calculate' extension 9C:\MinGW\bin\gcc.exe -mdll -O -Wall -DMS_WIN64 "-IC:\Users\ユーザ名\AppData\Local\conda\conda\envs\anaconda\include" "-IC:\Users\ユーザ名\AppData\Local\conda\conda\envs\anaconda\include" -c cythonfn.c -o build\temp.win-amd64-3.6\Release\cythonfn.o 10In file included from C:\Users\ユーザ名\AppData\Local\conda\conda\envs\anaconda\include/Python.h:65:0, 11 from cythonfn.c:4: 12C:\Users\ユーザ名\AppData\Local\conda\conda\envs\anaconda\include/pytime.h:112:5: warning: 'struct timeval' declared inside parameter list 13 _PyTime_round_t round); 14 ^ 15C:\Users\ユーザ名\AppData\Local\conda\conda\envs\anaconda\include/pytime.h:112:5: warning: its scope is only this definition or declaration, which is probably not what you want 16C:\Users\ユーザ名\AppData\Local\conda\conda\envs\anaconda\include/pytime.h:117:5: warning: 'struct timeval' declared inside parameter list 17 _PyTime_round_t round); 18 ^ 19writing build\temp.win-amd64-3.6\Release\calculate.cp36-win_amd64.def 20C:\MinGW\bin\gcc.exe -shared -s build\temp.win-amd64-3.6\Release\cythonfn.o build\temp.win-amd64-3.6\Release\calculate.cp36-win_amd64.def "-LC:\Users\ユーザ名\AppData\Local\conda\conda\envs\anaconda\libs" "-LC:\Users\ユーザ名\AppData\Local\conda\conda\envs\anaconda\PCbuild\amd64" -lpython36 -lmsvcr140 -o "C:\Users\ユーザ名\Dropbox\prg\make_tips\calculate.cp36-win_amd64.pyd" 21c:/mingw/bin/../lib/gcc/mingw32/5.3.0/../../../../mingw32/bin/ld.exe: C:\Users\ユーザ名\AppData\Local\conda\conda\envs\anaconda\libs/python36.lib(python36.dll): Recognised but unhandled machine type (0x8664) in Import Library Format archive 22C:\Users\ユーザ名\AppData\Local\conda\conda\envs\anaconda\libs/python36.lib: error adding symbols: File format not recognized 23collect2.exe: error: ld returned 1 exit status 24error: command 'C:\\MinGW\\bin\\gcc.exe' failed with exit status 1 25
また、動かしたいプログラムを以下に示します
python
1setup.py 2 3# -*- coding: utf-8 -*- 4 5from distutils.core import setup 6from distutils.extension import Extension 7from Cython.Distutils import build_ext 8 9# for notes on compiler flags e.g. using 10# export CFLAGS=-O2 11# so gcc has -O2 passed (even though it doesn't make the code faster!) 12# http://docs.python.org/install/index.html 13 14ext_modules = [ 15 Extension( "calculate", ["cythonfn.pyx"] ), 16] 17 18setup( 19 name = "sample calculate app" , 20 cmdclass={'build_ext': build_ext }, 21 ext_modules = ext_modules, 22) 23 24------------------------------------------------------------------------- 25cythonfn.pyx 26 27# -*- coding: utf-8 -*- 28 29def calculate_z(maxiter, zs, cs): 30 """Calculate output list using Julia update rule""" 31 output = [0] * len(zs) 32 for i in range(len(zs)): 33 n = 0 34 z = zs[i] 35 c = cs[i] 36 while n < maxiter and abs(z) < 2: 37 z = z * z + c 38 n += 1 39 output[i] = n 40 return output 41 42 43
minwgはcondaでインストールしました
distutils.cfgとして
[build]
compiler = mingw32
以上のようなファイルを
C:\Users\AppData\Local\conda\conda\envs\anaconda\Lib\distutils
にいれましたが
minwg32で良いのかどうかと、場所もここでいいのかが不安です
どうすればよろしいでしょうか

回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。