os为centos6.3 


  
  1. Linxu下编译方法安装python  
  2. [root@lzz opt]# pwd 
  3. /opt 
  4. #下载解压 
  5. [root@lzz opt]# wget http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz 
  6. [root@lzz opt]# tar -zxvf Python-2.7.3.tgz  
  7. [root@lzz opt]# cd Python-2.7.3 
  8. #配置编译 
  9. [root@lzz Python-2.7.3]# ./configure --prefix=/usr/local/python2.7 
  10. [root@lzz Python-2.7.3]# make 
  11. [root@lzz Python-2.7.3]# make install 
  12. #软连接配置 
  13. [root@lzz Python-2.7.3]# ln -s /usr/local/python2.7/bin/python /bin/python2.7   
  14. [root@lzz bin]# python2.7   

 


  
  1. Linux下使用setuptools安装类库的过程 
  2. #下载解压 
  3. [root@lzz/opt]#wget https://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz#md5=7df2a529a074f613b509fb44feefe74e 
  4. [root@lzz opt]# tar -zxvf setuptools-0.6c11.tar.gz  
  5. [root@lzz opt]# cd setuptools-0.6c11 
  6. #编译安装 
  7. [root@lzz setuptools-0.6c11]# python2.7 setup.py build  
  8. [root@lzz setuptools-0.6c11]# python2.7 setup.py install 
  9. [root@lzz bin]# ln -s /usr/local/python2.7/bin/easy_install /bin/easy_install-2.7 

#类库安装 setuptools方法

#安装django

[root@lzz orangle_liu]# easy_install-2.7 django

安装 provy

[root@lzz lib]# easy_install-2.7 provy

 

#安装类库 setup.py方法

#mysqldb

[root@lzz/opt]#wget http://downloads.sourceforge.net/project/mysql-python/mysql-python-test/1.2.3c1/MySQL-python-1.2.3c1.tar.gz?use_mirror=nchc

[root@lzz opt]# tar -zxvf MySQL-python-1.2.3c1.tar.gz 

[root@lzz opt]# cd MySQL-python-1.2.3c1

[root@lzz MySQL-python-1.2.3c1]# python2.7 setup.py build

[root@lzz MySQL-python-1.2.3c1]# python 2.7 setup.py install