给CentOS 5.5升级Python2.7 Django安装

时间:2022-04-06 07:36:59

首先,对于初学者我来说,python3对于我有点新,网上也有些教程学者认为学2.7比较好,其实我也是这么认为的~ 

好吧,把python 2.4升级为2.7吧

首先,还是保留原版本吧,覆盖这个东东不太好,也不知道谁说的,物理删除总是那么不安全。。。。。

用的VM虚拟机~建立个vsftp,把下载好的python2.7.tgz包考过去喽

#tar -zxf Python2.7.tgz //解压缩
#cd Python2.7
#mkdir /usr/local/python2.7 //创建安装目录
#configure --prefix=/usr/local/python2.7  //前缀,安装目录
#make && make install //编译&&安装
#mv /usr/bin/python /usr/bin/python_2.4 //备份老版本连接
#ln -s /usr/local/python2.7/bin/python2.7 /usr/bin/python //为新版本python建立软连接
#python
Python 2.7.3 (default, Jan 11 2013, 22:55:30)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-52)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
 

顺便把Django装上喽

#tar -zxf Django.tar.gz
#cd Django
#python setup.py install
#python
Python 2.7.3 (default, Jan 11 2013, 22:55:30)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-52)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>

>>> import django
>>> django.VERSION
(1, 4, 3, final', 1) //OK