LoginSignup
29
36

More than 5 years have passed since last update.

WindowsでもCythonを使えるようにする。

Last updated at Posted at 2015-07-31

後述のURLを参照しつつ、WindowsでもCythonを使えるようにしたのでメモを残す。

Cythonのインストール

windows用にコンパイル済みのwhlファイルを使ってpipコマンドで
インストールする。

http://www.lfd.uci.edu/~gohlke/pythonlibs/#cython
から、自分のPython(=CPython)のバージョンと32bit版か64bit版かにあわせた
対応したwhlファイルをダウンロードする。

pip install Cython-0.22.1-cp27-none-win32.whl

コンパイラにMinGWのgcc,g++を使うため、MinGWのインストール

次にgcc,g++を使えるようにするためにMinGWを[2]を参照しつつインストールした。
c:\mingw\binを環境変数Pathに追加。
MinGWをインストール 最低gccとg++にチェック。

Cythonでのコンパイラの指定を簡略化するための設定ファイルの記述

distutilsがMinGWを使うように設定するため
[build]
compiler = mingw32
という内容でC:\Python27\Lib\distutilにdistutils.cfgという名前で保存。

参照したURL

[1]:Unofficial Windows Binaries for Python Extension Packages
http://www.lfd.uci.edu/~gohlke/pythonlibs/

[2]:MinGWのインストールと使い方(2014年版)
http://web.plus-idea.net/2014/06/mingw-install-2014/

[3]:意外に簡単。Cythonのインストール・使い方覚書
http://hennohito.cocolog-nifty.com/blog/2011/07/cython-c1cb.html

29
36
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
29
36