2016-07-01から1ヶ月間の記事一覧

cythonコマンドを使ったcythonコードのビルド

Cythonのtutorialでsetup.pyを使うやり方は載ってるのだがcythonコマンドでやる方法は 詳述されてなかったので、メモ. Learning Cython Programming | PACKT Booksより.Cythonコンパイルの手順 Cython のコードはPythonと異なりコンパイルする必要があるが、…

Numpyでヘッダーのinclude pathを取得する方法 ( How to print include path of Numpy FIles ? )

Pythonでヘッダーのinclude pathを取得する方法 ( How to print include path of Python FIles ? ) - mcbiophys'sDigital Bio の応用問題. cythonを使うときにsetup.pyでよく使うトリックだが makefileでinclude pathが欲しい場合も当然使える. NUMPY_INCL_P…

Pythonでヘッダーのinclude pathを取得する方法 ( How to print include path of Python FIles ? )

MakefileでPythonのファイルパスを取得したいときなどがたまにあるだろう。 そんなときはsys.prefixのトリックが便利だ. import sys print(sys.prefix) #/usr/local/Cellar/python/2.7.xx/Frameworks/Python.framework/Versions/2.7 etc ... MakefileでPytho…

vimの外部grepでshell出力を抑える方法  

vimの外部grep(i.e :grepコマンド)はshellの出力が鬱陶しいので vimrcに以下のように書くことで,新しい:Grepコマンドを定義してそれを黙らせることができる. command! -nargs=+ Grep execute 'silent grep! <args>' |:redraw! -nargs=+ : n>= 1の引数をもつ silent</args>…

"tee" command の有用性

プログラムの間のパイプで渡されているデータを見てみたい時 "tee" command が非常に有用である このteeコマンドは標準出力からデータを受け取ってファイルに書き出し、また標準出力に再びそのデータを受け渡しする。 この方法であれば、pipでつないだプログ…