cython を使ってみる
【関連する外部ページ】
http://omake.accense.com/static/doc-ja/cython/src/userguide/tutorial.html
前準備
Python の準備(Windows,Ubuntu 上)
- Windows での Python 3.10,関連パッケージ,Python 開発環境のインストール(winget を使用しないインストール): 別ページ »で説明
- Ubuntu では,システム Pythonを使うことができる.Python3 開発用ファイル,pip, setuptools のインストール: 別ページ »で説明
【サイト内の関連ページ】
- Python のまとめ: 別ページ »にまとめ
- Google Colaboratory の使い方など: 別ページ »で説明
【関連する外部ページ】 Python の公式ページ: https://www.python.org/
Python の公式ページ: https://www.python.org/
cython を使うプログラム例
- cython のインストール
python -m pip install cython
- helloworld.pyx
print "Hello World"
- setup.py
from distutils.core import setup from distutils.extension import Extension from Cython.Distutils import build_ext setup( cmdclass = {'build_ext': build_ext}, ext_modules = [Extension("helloworld", ["helloworld.pyx"])] )
- ライブラリファイルの作成
python setup.py build_ext --inplace