官术网_书友最值得收藏!

Installing Cython

Since Cython is a programming language, we must install its respective compiler, which just so happens to be the aptly named Cython.

There are many different ways to install Cython. The preferred one would be to use pip:

$ pip install Cython

This should work on both Linux and Mac. Alternatively, you can use your Linux distribution's package manager to install Cython:

$ yum install cython     # will work on Fedora and Centos
$ apt-get install cython # will work on Debian based systems.

For Windows, although there are a plethora of options available, following this wiki is the safest option to stay up-to-date: http://wiki.cython.org/InstallingOnWindows.

Emacs mode

There is an emacs mode available for Cython. Although the syntax is nearly the same as Python, there are differences that conflict in simply using Python-mode. You can grab cython-mode.el from the Cython source code (inside the Tools directory.) The preferred way of installing packages to emacs would be to use a package repository like MELPA:

To add the package repository to emacs, open your ~/.emacs configuration file and add:

(when (>= emacs-major-version 24)
  (require 'package)
  (add-to-list
   'package-archives
   '("melpa" . "http://melpa.org/packages/")
   t)
  (package-initialize))

Once you add this and reload your configuration to install the Cython mode, you can simply run:

'M-x package-install RET cython-mode'

Once this is installed, you can activate the mode by adding this into your emacs config file:

(require 'cython-mode)

You can activate the mode manually at any time with:

'M-x cython-mode RET'

Getting the code examples

Throughout this book, I intend to show real examples that are easy to digest in order to help you get a feel of the different things you can achieve with Cython. To access and download the code used, please clone this repository:

$ git clone git://github.com/redbrain/cython-book.git
主站蜘蛛池模板: 宜阳县| 行唐县| 蕉岭县| 镇远县| 连州市| 苏州市| 沙雅县| 贡嘎县| 东乌珠穆沁旗| 亚东县| 丹江口市| 宁陵县| 河东区| 来宾市| 三河市| 双峰县| 宝兴县| 张家川| 宝应县| 黄冈市| 洪湖市| 客服| 陈巴尔虎旗| 苏尼特右旗| 丽水市| 清远市| 博爱县| 荆门市| 虎林市| 广饶县| 孝昌县| 抚远县| 聂拉木县| 隆化县| 南皮县| 康马县| 镇江市| 武乡县| 四平市| 马边| 扶沟县|