1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# chmod +x install-python.sh
# ./install-python.sh
#!/bin/bash
# Install necessary packages
yum -y install gcc gdbm-devel readline-devel ncurses-devel zlib-devel bzip2-develsqlite-devel db4-devel openssl-devel tk-devel bluez-libs-devel make
cd /var/tmp
wget http://sqlite.org/sqlite-amalgamation-3.7.3.tar.gz
tar xfz sqlite-amalgamation-3.7.3.tar.gz
cd sqlite-3.7.3/
./configure
make
make install
cd /var/tmp
wget http://www.python.org/ftp/python/2.7.1/Python-2.7.1.tgz
tar xvfz Python-2.7.1.tgz
cd Python-2.7.1
./configure --prefix=/opt/python2.7.1 --with-threads --enable-shared
make
make install
touch /etc/ld.so.conf.d/opt-python2.7.1.conf
echo "/opt/python2.7.1/lib/" >> /etc/ld.so.conf.d/opt-python2.7.1.conf
ldconfig
ln -sf /opt/python2.7.1/bin/python /usr/bin/python2.7
cd /var/tmp
wget http://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11-py2.7.egg
sh setuptools-0.6c11-py2.7.egg --prefix=/opt/python2.7.1
/opt/python2.7.1/bin/easy_install pip
ln -sf /opt/python2.7.1/bin/pip /usr/bin/pip
pip install virtualenv
ln -sf /opt/python2.7.1/bin/virtualenv /usr/bin/virtualenv
echo "alias python=/opt/python2.7.1/bin/python" >> ~/.bash_profile
echo "alias python2.7=/opt/python2.7.1/bin/python" >> ~/.bash_profile
echo "PATH=$PATH:/opt/python2.7/bin" >> ~/.bash_profile
source ~/.bash_profile
# Done
|
在Centos 5.{5,6} 安装Python 2.7
最新推荐文章于 2020-12-05 13:47:11 发布