質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.47%
Windows 10

Windows 10は、マイクロソフト社がリリースしたOSです。Modern UIを標準画面にした8.1から、10では再びデスクトップ主体に戻され、UIも変更されています。PCやスマホ、タブレットなど様々なデバイスに幅広く対応していることが特徴です。

MinGW

MinGW(ミン・ジー・ダブリュー)は GNUツールチェーンのWindows移植版です。 ランタイムライブラリと開発ツールで構成されています。

Python

Pythonは、コードの読みやすさが特徴的なプログラミング言語の1つです。 強い型付け、動的型付けに対応しており、後方互換性がないバージョン2系とバージョン3系が使用されています。 商用製品の開発にも無料で使用でき、OSだけでなく仮想環境にも対応。Unicodeによる文字列操作をサポートしているため、日本語処理も標準で可能です。

Q&A

解決済

1回答

4362閲覧

cythonを使いたい

kohekoh

総合スコア140

Windows 10

Windows 10は、マイクロソフト社がリリースしたOSです。Modern UIを標準画面にした8.1から、10では再びデスクトップ主体に戻され、UIも変更されています。PCやスマホ、タブレットなど様々なデバイスに幅広く対応していることが特徴です。

MinGW

MinGW(ミン・ジー・ダブリュー)は GNUツールチェーンのWindows移植版です。 ランタイムライブラリと開発ツールで構成されています。

Python

Pythonは、コードの読みやすさが特徴的なプログラミング言語の1つです。 強い型付け、動的型付けに対応しており、後方互換性がないバージョン2系とバージョン3系が使用されています。 商用製品の開発にも無料で使用でき、OSだけでなく仮想環境にも対応。Unicodeによる文字列操作をサポートしているため、日本語処理も標準で可能です。

0グッド

0クリップ

投稿2017/07/12 08:11

編集2017/07/12 08:49

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で良いのかどうかと、場所もここでいいのかが不安です

どうすればよろしいでしょうか

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

自己解決

一個前の質問の回答で解決することができました
ありがとうございました

投稿2017/07/12 10:48

kohekoh

総合スコア140

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.47%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問