CentOS6.0 安装Python3.2.2

上一篇 / 下一篇  2012-03-12 08:58:17 / 个人分类:Linux

Unix/Linux系统下基本上都预安装了Python,但有时候它的版本可能不是符合我们要求的。CentOS6.0默认安装版本是2.6,而现在Python最新的版本是3.2.2. 为此下面记录了在CentOS上安装Python3.2.2的详细过程:
1)用CentOS终端下载最新版本的Python
--------------------------------------------------------------------
# Install required build dependencies
yum install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel

# Fetch and extract source. Please refer to http://www.python.org/download/releases
# to ensure the latest source is used.
wget http://www.python.org/ftp/python/3.2.2/Python-3.2.2.tar.bz2
tar -xjf Python-3.2.2.tar.bz2
cd Python-3.2.2
---------------------------------------------------------------------
2)编译安装第一步就出现如下错误,无法继续安装:
---------------------------------------------------------------------
# Configure the build with a prefix (install dir) of /opt/python3, compile, and install.
./configure --prefix=/opt/python3
checking for –without-gcc… no
checking for gcc… no
checking for cc… no
checking for cl.exe… no
configure: error: in `/opt/Python-2.7.2′:
configure: error: no acceptable C compiler found in $PATH
See `config.log’ for more details
---------------------------------------------------------------------
3)需要安装gcc编译环境:yum -y install gcc
然后再执行:
---------------------------------------------------------------------
# Configure the build with a prefix (install dir) of /opt/python3, compile, and install.
./configure --prefix=/opt/python3
make
sudo make install
---------------------------------------------------------------------
4)检查Python3安装目录
---------------------------------------------------------------------
$/opt/python3/bin/python3 -V
Python 3.2.2

参考文献:
http://www.hosting.com/support/linux/installing-python-3-on-centosredhat-5x-from-source
http://farlee.info/archives/centos5-python-mod_wsgi-django-install-osqa.html

TAG: CentOS Python python

 

评分:0

我来说两句

Open Toolbar