Python

ついでにcgiでpythonを実行する環境も作った

前にRubyをcgiで動かすためにapacheは設定してある apache2でmod_rubyでrubyをcgiで動かす設定 - 橋本詳解 ついでにPythonもcgiで動かせるようにする sudo apt-cache search python | grep apacheしてみたら丁度良いのがあったので、aptでmod_python入れれた…

さくらのpythonバージョンアップでmercurialリポジトリが動かなくなったのを対応

さくらインターネットスタンダードプランのpythonが2.4から2.5に上がって、virtual-pythonで構築してた環境が壊れたのでやりなおす。 hgweb.cgiも500 Internal Server Errorだし、sshでログインしてhgやpythonなどを実行しても Could not find platform inde…

3章 その8 hashのkeyに配列を使う

p.39のhcluster関数の distances = {} if(clust[i].id,clust[j].id) not in distances: distances[(clust[i].id,clust[j].id)] = distance(clust[i].vec,clust[j].vec) がいまいちわからなかったんだけど、よく見たらリストをキーにとるディクショナリ(ハッ…

3章 その7 pythonのrange、rubyの..と...

前の章から出てきたrange関数はrubyでは..か...で使えるが、それぞれちょっと違う。 これややこしいな。どう覚えればいいんだろirbで試す >> for i in 0..5; puts i; end 0 1 2 3 4 5 => 0..5 >> for i in 0...5; puts i; end 0 1 2 3 4 => 0...5 pythonだと…

python、easy_installインストール

Windowsでpython開発環境を作るのはあんまり良くないのかな。やるならVMWarePlayer+Ubuntuでやった方がいいかも.... windowsでpython環境をつくる。あと集合知プログラミング21ページから使うpydeliciousのインストール。 Python2.5.2をインストールする htt…

UbuntuでMercurialリポジトリをhgweb.cgiで公開

まず、以前aptで入れたmercurialを削除する。こっちではhgwebが使えないので。 sudo apt-get remove mercurialpython開発環境とパッケージ管理ツールのeasy_installを入れる sudo apt-get install python-dev python cd ~/tmp wget http://peak.telecommunit…

PythonでCGI

http://d.hatena.ne.jp/shokai/20080219/1203439879 と同じ様にapache2を設定しtest.cgi #!/usr/bin/python print "Content-Type: text/html\n\n" print "test" これでも設置してpermission設定して chmod 755 test.cgi動いたらok

さくらにmercurialインストールしてhgwebでhttp公開する

ほぼまっさら状態のさくらインターネットスタンダードプランでmercurialというバージョン管理システムを入れてhgwebで公開もするところまで。 全部で5MBほどしか使わないので、サーバー容量にもやさしい。 こんな感じで公開した。これから公開プロジェクトが…

easy_install入れて、mercurialも入れる

wget http://peak.telecommunity.com/dist/ez_setup.py python ez_setup.pyこれでmercurialがはいる easy_install -U mercurial1.0.1が入った。hg -v などとしてみて、1.0.1が入った事を確認

virtual-python入れる

mercurialが使いたいだけなんだがなぜかうまくいかないのでとりあえずvirtual-python入れてみるhttp://labs.unoh.net/2007/04/python.html より wget http://peak.telecommunity.com/dist/virtual-python.py python virtual-python.pyこれで/home/username/l…