Setup Python using Yum
This is simplest method to install development tools on CentOS. Run below commands to setup the python using yum.
[vagrant@localhost ~]$ sudo yum -y update [vagrant@localhost ~]$ sudo yum groupinstall -y development
Or
Setup Python using source code
To setup python using source code, you would first download the source code for the version you want to install. Then build the source code and configure.
You can use "wget" command to download the compressed source code. If you don't have wget installed, use yum to install wget as below.
Download the source code for python 2.7.6 using below command. You can choose which version you want to install and download sources from here.
[vagrant@localhost ~]$ sudo yum groupinstall -y 'development tools'
Setup Python using source code
To setup python using source code, you would first download the source code for the version you want to install. Then build the source code and configure.
You can use "wget" command to download the compressed source code. If you don't have wget installed, use yum to install wget as below.
You would need "xz" tool to decode the source code.[vagrant@localhost ~]$ sudo yum install wget
Now you are ready to download the source code.[vagrant@localhost ~]$ sudo yum install xz-libs
Download the source code for python 2.7.6 using below command. You can choose which version you want to install and download sources from here.
Decode the archive then extract using below command.[vagrant@localhost ~]$ wget http://www.python.org/ftp/python/2.7.6/Python-2.7.6.tar.xz
Traverse to extracted python source code directory then run configure.[vagrant@localhost ~]$ xz -d Python-2.7.6.tar.xz [vagrant@localhost ~]$ tar -xvf Python-2.7.6.tar
Run 'make install' build the source and install the binaries. You can also use the 'altinstall' to replace older installation.[vagrant@localhost ~]$ cd Python-2.7.6 [vagrant@localhost ~]$ ./configure --prefix=/usr/local
Once the installation complete, you can verify installation by running the python command. If you get the command not found then update the path variable as below.[vagrant@localhost ~]$ make altinstall
Now your python is setup for use.[vagrant@localhost ~]$ export PATH="/usr/local/bin:$PATH"
No comments:
Post a Comment