cythonを動かしたいと思って
mingwをインストールしたのですが
そこでつまってしまいました
開発環境はanacondaで 、windows10です
python3系で動かせればうれしいです
pythonでcythonのsetup.pyを実行しようとすると
python
python setup.py build_ext --inplace ------------------------------------------------------- 実行結果 running build_ext skipping 'cythonfn.c' Cython extension (up-to-date) building 'calculate' extension C:\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 In file included from C:\Users\ユーザ名\AppData\Local\conda\conda\envs\anaconda\include/Python.h:65:0, from cythonfn.c:4: C:\Users\ユーザ名\AppData\Local\conda\conda\envs\anaconda\include/pytime.h:112:5: warning: 'struct timeval' declared inside parameter list _PyTime_round_t round); ^ C:\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 C:\Users\ユーザ名\AppData\Local\conda\conda\envs\anaconda\include/pytime.h:117:5: warning: 'struct timeval' declared inside parameter list _PyTime_round_t round); ^ writing build\temp.win-amd64-3.6\Release\calculate.cp36-win_amd64.def C:\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" c:/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 C:\Users\ユーザ名\AppData\Local\conda\conda\envs\anaconda\libs/python36.lib: error adding symbols: File format not recognized collect2.exe: error: ld returned 1 exit status error: command 'C:\\MinGW\\bin\\gcc.exe' failed with exit status 1
また、動かしたいプログラムを以下に示します
python
setup.py # -*- coding: utf-8 -*- from distutils.core import setup from distutils.extension import Extension from Cython.Distutils import build_ext # for notes on compiler flags e.g. using # export CFLAGS=-O2 # so gcc has -O2 passed (even though it doesn't make the code faster!) # http://docs.python.org/install/index.html ext_modules = [ Extension( "calculate", ["cythonfn.pyx"] ), ] setup( name = "sample calculate app" , cmdclass={'build_ext': build_ext }, ext_modules = ext_modules, ) ------------------------------------------------------------------------- cythonfn.pyx # -*- coding: utf-8 -*- def calculate_z(maxiter, zs, cs): """Calculate output list using Julia update rule""" output = [0] * len(zs) for i in range(len(zs)): n = 0 z = zs[i] c = cs[i] while n < maxiter and abs(z) < 2: z = z * z + c n += 1 output[i] = n return output
調べているとこれがリンクエラーのようなのですが
どう改善していいかわかりません
よろしくお願いします
ちなみに
http://www.geocities.jp/penguinitis2002/computer/programming/Python/cython/cython.html
このサイトにライブラリのリンクのつなぎ方が書いてあるのですが
どうしていいのかがわかりません
-------------追記----------------
minwgのインストール方法
http://web.plus-idea.net/2014/06/mingw-install-2014/
このサイトの通りに実行しました
最後のgcc --versionで確認することができたので
インストールはうまくいっていると思います
しかし、32bitか64かはわかっていません
まだ回答がついていません
会員登録して回答してみよう