Skip to content

Instantly share code, notes, and snippets.

@akisatok
Last active August 29, 2015 14:13
Show Gist options
  • Save akisatok/4e8a89f60894e95390e6 to your computer and use it in GitHub Desktop.
Save akisatok/4e8a89f60894e95390e6 to your computer and use it in GitHub Desktop.
root権限がないときのpython・numpy・scipyのソースからのインストール on Linux ref: http://qiita.com/_akisato/items/9227b8f17026f3bd76c1
# cd ~/tmp
# wget http://www.bzip.org/1.0.6/bzip2-1.0.6.tar.gz
# tar xzf bzip2-1.0.6.tar.gz
# cd bzip2-1.0.6
# make -f Makefile-libbz2_so
# make
# make install PREFIX=/home/akisato/src/downloads/bzip2-1.0.6
# export CFLAGS=-I/home/akisato/src/downloads/include
# export CPPFLAGS=$CFLAGS
# export LDFLAGS=-L/home/akisato/src/downloads/lib
# cd ~/tmp
# wget https://www.python.org/ftp/python/2.7.6/Python-2.7.6rc1.tgz
# tar xzf Python-2.7.6rc1.tgz
# cd Python-2.7.6
# ./configure --prefix=/home/akisato/src/downloads/python-2.7.6rc1 --with-threads --enable-shared LDFLAGS=-Wl,-rpath,/home/akisato/src/downloards/python-2.7.6rc1/lib
# vi Makefile
CCSHARED=-fPIC
# make
# make install
# export PATH=/home/akisato/src/downloads/python-2.7.6rc1/bin:${PATH}
# export PYTHONPATH=/home/akisato/src/downloads/python-2.7.6rc1/lib/python2.7/site-packages
# cd ~/tmp
# wget http://www.netlib.org/blas/blas.tgz
# tar xzf blas.tgz
# cd BLAS
# gfortran -O3 -m64 -fPIC -c *.f
# ar r libfblas.a *.o
# ranlib libfblas.a
# rm -rf *.o
# cp libfblas.a /home/akisato/lib # 永続的に残す場所へコピー
# gfortran -O3 -m64 -fPIC -shared *.f -o libfblas.so
# cp libfblas.so /home/akisato/lib # 永続的に残す場所へコピー
# export BLAS=/home/akisato/lib/libfblas.so # scipyインストールの時だけ見えていればOK
# cd ~/tmp
# wget http://www.netlib.org/lapack/lapack.tgz
# tar xzf lapack.tgz
# cd lapack
# cp INSTALL/make.inc.gfortran make.inc
# vi make.inc
OPTS = -O2 -m64 -fPIC
NOOPT = -m64 -fPIC
# make lapacklib
# cp liblapack.a /home/akisato/lib # 永続的に残す場所へコピー
# export LAPACK=/home/akisato/lib/liblapack.a # scipyインストールの時だけ見えていればOK
# which python
/home/akisato/src/downloads/python-2.7.6rc1/bin/python
# wget http://sourceforge.net/projects/numpy/files/NumPy/1.8.0/numpy-1.8.0.tar.gz/download --no-check-certificate
# tar xzf numpy-1.8.0.tar.gz
$ cd numpy-1.8.0
$ python setup.py build
$ python setup.py install
# unset CFLAGS
# unset CCFLAGS
# unset LDFLAGS
# wget http://sourceforge.net/projects/scipy/files/scipy/0.14.0/scipy-0.14.0.tar.gz/download
# tar xzvf scipy-0.14.0.tar.gz
# cd scipy-0.14.0
# python setup.py build
# python setup.py install
# cd ~/tmp
# wget https://pypi.python.org/packages/source/s/setuptools/setuptools-3.4.1.tar.gz --no-check-certificate
# tar xzf setuptools-3.4.1.tar.gz
# cd setuptools-3.4.1
# python ez_setup.py
# easy_install pip
# pip freeze
(すでにインストールしたパッケージが表示されればOK)
# wget https://bootstrap.pypa.io/get-pip.py --no-check-certificate
# python get-pip.py
# wget https://bootstrap.pypa.io/get-pip.py --no-check-certificate
# python get-pip.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment