url:http://www.python.org/ftp/python/3.2/Python-3.2.tar.bz2
Python的安装与升级
下载Python
下载地址:http://www.python.org/ftp/python/3.2/Python-3.2.tar.bz2
安装Python
1 进入shell
2 解包:tar jxvf Python-3.2.tar.bz2
3 配置并安装:
* cd Python3.2
* ./configure
* make && make install
修改默认的bash命令
- 到此我们已经安装完成了,但是我们进入shell后,发现python还是2.4.3版本,我们需要建立一个链接
1 备份旧文件:mv /usr/bin/python /usr/bin/python-2.4.3.bak
2 对python命令进行软链:ln -s /usr/local/bin/python3.2 /usr/bin/python
3 检查python版本: python -V
配置yum
- 由于yum是基于python2.4的程序,所以我们需要重新配置yum程序
1 vim /usr/bin/yum
2 将其中的/usr/bin/python修改为#/usr/bin/python2.4
3 wq
安装python访问pgsql数据库的扩展
- yum install postgresql-devel.x86_64
- wget http://initd.org/psycopg/tarballs/psycopg2-latest.tar.gz
- tar -zvxf psycopg2-latest.tar.gz
- cd psycopg2-2.4.6
- python setup.py build
- python setup.py install
安装python访问mysql数据库的MySQLdb扩展
- yum install mysql-devel
- wget http://sourceforge.net/projects/mysql-python/files/latest/download
- tar xfz MySQL-python-1.2.3.tar.gz
- cd MySQL-python-1.2.3
- 得到mysql_config的路径
- whereis mysql_config
- mysql_config: /usr/bin/mysql_config
- vim site.cfg
- 修改mysql_config为mysql配置文件的路径 /usr/bin/mysql_config
- 还要修改 threadsafe = False
- python setup.py build
- python setup.py install
安装python访问oracle的扩展
- 先要安装oracle-instantclient11.1
- wget http://download.oracle.com/otn/linux/instantclient/10204/basic-10.2.0.4.0-linux-x86_64.zip
- unzip instantclient-basic-linux.x64-10.2.0.4.0.zip
- cp -rf instantclient_10_2 /opt/
- vi /etc/profile
- export ORACLE_HOME=/opt/instantclient_10_2
- export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME
- source /etc/profile
- 安装cx_oracle
- wget http://downloads.sourceforge.net/project/cx-oracle/5.1.2/cx_Oracle-5.1.2.tar.gz
- tar -zvxf cx_Oracle-5.1.2.tar.gz
- cd cx_Oracle-5.1.2
- python setup.py build
- python setup.py install
- 如果报错ImportError: libclntsh.so.10.1: cannot open shared object file: No such file or directory
- locate libclntsh.so.10.1
- 得到路径/home/oracle/product/10.2.0/lib/libclntsh.so.10.1
- vim /etc/ld.so.conf
- 末尾加入/home/oracle/product/10.2.0/lib/
- ldconfig
- 问题解决
安装Image
- wget http://effbot.org/downloads/Imaging-1.1.7.tar.gz
- tar xfz Imaging-1.1.7.tar.gz
- cd Imaging-1.1.7
- python setup.py build_ext -i
- python setup.py build
- python setup.py install
- 或者easy_install PIL