1、安裝python
python版本庫https://www.python.org/ftp/python/禁荒,此處我選擇2.7.9版本的痊班,在安裝python的時(shí)候,使用--prefix指定安裝路徑即可哲鸳,命令如下:
wget https://www.python.org/ftp/python/2.7.9/Python-2.7.9.tgz
tar -xzf Python-2.7.9.tgz
cd Python-2.7.9
mkdir -p /home/lilei/software/python27
./configure --prefix="/home/lilei/software/python27"
make
make install
2臣疑、安裝setuptools
setuptools主要是為安裝pip做準(zhǔn)備的,下面是從下載到安裝的全部命令,使用上面安裝的指定路徑的python
/home/lilie/software/python27/bin/python進(jìn)行安裝:
wget --no-check-certificate http://pypi.python.org/packages/source/s/setuptools/setuptools-2.0.tar.gz
tar -xzvf setuptools-2.0.tar.gz
cd setuptools-2.0
/home/lilei/software/python27/bin/python setup.py install
3徙菠、安裝pip
使用pip來安裝python相關(guān)庫讯沈,方便簡單,此處將python setup.py install的python換成自己安裝的指定路徑python
/home/lilie/software/python27/bin/python setup.py install.
wget --no-check-certificate https://pypi.python.org/packages/41/27/9a8d24e1b55bd8c85e4d022da2922cb206f183e2d18fee4e320c9547e751/pip-8.1.1.tar.gz#md5=6b86f11841e89c8241d689956ba99ed7
tar -xzf pip-8.1.1.tar.gz
cd pip-8.1.1
/home/lilei/software/python27/bin/python setup.py install
4婿奔、安裝相關(guān)庫
進(jìn)入python安裝目錄的bin路徑下缺狠,安裝下面相關(guān)庫,經(jīng)測試萍摊,下列庫均可安裝挤茄。
simplejson
redis
numpy
scipy
sklearn
matplotlib
安裝命令:
cd /home/lilei/software/python27/bin/
./pip install simplejson
./pip install redis
./pip install numpy
./pip install scipy
./pip install sklearn
./pip install matplotlib
參考:http://blog.csdn.net/dream_angel_z/article/details/51338546