さくらVPSにpythonをインストールする
さくらVPSのCentOSに入っているpythonのバージョンが2.6.6だったので,最新版の2.7.4を入れる.
$ sudo yum groupinstall "Development Tools" $ sudo yum install zlib zlib-devel tk-devel tcl-devel sqlite-devel ncurses-devel gdbm-devel readline-devel bzip2-devel db4-devel openssl-devel $ wget https://www.python.org/ftp/python/2.7.9/Python-2.7.9.tgz $ tar -zvxf Python-2.7.9.tgz
mod_wsgiを使いたいので,--enabled-sharedを指定する.
$ cd Python-2.7.9 $ ./configure --enable-shared $ make
実行するとエラーが出る.
$ python -V python: error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No such file or directory
対処するためにシンボリックリンクを貼る.
$sudo ln /usr/local/lib/libpython2.7.so.1.0 /lib64/
これで大丈夫なはず.
$ python -V Python 2.7.9
パッケージ管理のためにpipをインストールする.
$ wget https://bootstrap.pypa.io/get-pip.py $ sudo python get-pip.py