LoginSignup
2
2

More than 5 years have passed since last update.

さくらVPS 1GBにPython2.7を入れてみました。

Posted at

さくらVPS 1GBお試し期間終わりの通知 がきたので、ちょっと Python2.7 入れてみました。目的は ソーシャルデータの解析 です! データマイニングに Python は王道の一つのようなので経験しておこうという算段です。(・∀・)!!

下準備

[funya@hogex ~]$ cd /usr/local/bin/
[funya@hogex bin]$ ls
[funya@hogex ~]$ sudo yum install gcc
[funya@hogex bin]$ sudo yum install libjpeg-devel
[funya@hogex bin]$ sudo yum install zlib-devel
[funya@hogex bin]$ sudo wget http://www.sqlite.org/sqlite-autoconf-3070500.tar.gz
[funya@hogex bin]$ sudo tar xvfz sqlite-autoconf-3070500.tar.gz

ちなみに CTRL + U でコマンド全消しできるから楽。

sqliteのインストール

[funya@hogex bin]$ cd sqlite-autoconf-3070500
[funya@hogex bin]$ sudo ./configure
[funya@hogex bin]$ sudo make
[funya@hogex bin]$ sudo make install

Python2.7のインストール

[funya@hogex bin]$ sudo wget http://www.python.org/ftp/python/2.7/Python-2.7.tar.bz2
[funya@hogex bin]$ sudo tar xjvf Python-2.7.tar.bz2
[funya@hogex bin]$ cd Python-2.7
-bash: cd: Python-2.7: 許可がありません
[funya@hogex bin]$ sudo chmod a+rwx Python-2.7
[funya@hogex bin]$ ./configure --enable-shared

[funya@hogex bin]$ sudo yum -y install httpd-devel
[funya@hogex bin]$ sudo wget http://modwsgi.googlecode.com/files/mod_wsgi-3.3.tar.gz
[funya@hogex bin]$ sudo tar xvfz mod_wsgi-3.3.tar.gz
[funya@hogex bin]$ cd mod_wsgi-3.3
[funya@hogex mod_wsgi-3.3]$ sudo ./configure --with-apxs=/usr/sbin/apxs --with-python=/usr/local/bin/python
checking Apache version... 2.2.15
/usr/local/bin/python: error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No such file or directory
/usr/local/bin/python: error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No such file or directory
/usr/local/bin/python: error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No such file or directory
/usr/local/bin/python: error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No such file or directory
/usr/local/bin/python: error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No such file or directory
/usr/local/bin/python: error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No such file or directory
/usr/local/bin/python: error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No such file or directory
/usr/local/bin/python: error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No such file or directory
/usr/local/bin/python: error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No such file or directory
/usr/local/bin/python: error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No such file or directory
configure: creating ./config.status
config.status: creating Makefile

エラーでた。調査。

[funya@hogex bin]$ ldd python2.7

ふむ、ファイルは作成されているらしい。
毎度お決まりのシンボリックリンクですねこれは。

[funya@hogex lib64]$ sudo ln /usr/local/bin/Python-2.7/libpython2.7.so.1.0 libpython2.7.so.1.0
[funya@hogex mod_wsgi-3.3]$ sudo ./configure --with-apxs=/usr/sbin/apxs --with-python=/usr/local/bin/python
checking Apache version... 2.2.15
configure: creating ./config.status
config.status: creating Makefile
[funya@hogex mod_wsgi-3.3]$ sudo make
[funya@hogex mod_wsgi-3.3]$ sudo make install
[funya@hogex bin]$ python -V
Python 2.7
[funya@hogex bin]$ sudo python
Python 2.6.6 (r266:84292, Feb 22 2013, 00:00:18) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2
>>>

とりあえず動いた!
今日は一旦ここまでにしよ☆ミ


ref) 1. http://www.kzfmix.com/sakura/python.html
ref) 2. http://itpro.nikkeibp.co.jp/article/COLUMN/20060228/231200/
ref) 3. http://homepage3.nifty.com/nasunu-i/LinuxBeginner/Permission.htm
ref) 4. http://memo.yomukaku.net/entries/jbRkQkq

tip) 1.$ ll でファイルの詳細情報が見れる
tip) 2. tar xjvf Python_hogehoge.bz2
tip) 3. CTRL + U でコマンド全消し

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2