How to install Python 2.7.3 on CentOS 6.2
2012-10-24 15:03
603 查看
CentOS 6.2 ships with Python 2.6.6 and depends on that specific version. Be careful not to replace it or bad things will happen. If you need access to a newer version of Python you must compile it yourself and install it side-by-side with the system version.
Here are the steps necessary to install Python 2.7.3. The procedure is exactly the same for installing Python 3.2.3, just make sure you use the command
Execute all the commands below as root. Either log in as root temporarily or use sudo.
You also need a few extra libs installed before compiling Python or else you will run into problems later when trying to install various packages:
It is important to use
After running the commands above your newly installed Python 2.7.3 interpreter will be available as
The commands above will generate the script
This entry was posted in Guides and tagged CentOS, Python by Daniel Eriksson. Bookmark the permalink.
Here are the steps necessary to install Python 2.7.3. The procedure is exactly the same for installing Python 3.2.3, just make sure you use the command
"python3.2 setup.py install"when you install distribute.
Execute all the commands below as root. Either log in as root temporarily or use sudo.
Install development tools
In order to compile Python you must first install the development tools:# yum groupinstall "Development tools"
You also need a few extra libs installed before compiling Python or else you will run into problems later when trying to install various packages:
# yum install zlib-devel # yum install bzip2-devel # yum install openssl-devel # yum install ncurses-devel
Download, compile and install Python
# wget http://python.org/ftp/python/3.2.3/Python-3.2.3.tar.bz2 # wget http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tar.bz2 # tar xf Python-2.7.3.tar.bz2 # cd Python-2.7.3 # ./configure --prefix=/usr/local # make && make altinstall
It is important to use
altinstallinstead of
install, otherwise you will end up with two different versions of Python in the filesystem both named
python.
After running the commands above your newly installed Python 2.7.3 interpreter will be available as
/usr/local/bin/python2.7and the system version of Python 2.6.6 will be available as
/usr/bin/pythonand
/usr/bin/python2.6.
Installing and configuring distribute (setuptools)
After installing Python 2.7.3 you also need to install distribute (setuptools) so you can easily install new packages in the right location.# wget http://pypi.python.org/packages/source/d/distribute/distribute-0.6.30.tar.gz # tar xf distribute-0.6.27.tar.gz # cd distribute-0.6.27 # python2.7 setup.py install
The commands above will generate the script
/usr/local/bin/easy_install-2.7. Use this script to install packages for your new Python version:
# easy_install-2.7 virtualenv # easy_install-3.2 pymongo
This entry was posted in Guides and tagged CentOS, Python by Daniel Eriksson. Bookmark the permalink.
相关文章推荐
- How to install Python 2.7.3 on CentOS 6.2
- How to Install PHP-FPM on CentOS 6.2
- How to install python, wxPython and ride on CENTOS
- How to install Avast Antivirus on CentOS 6.2
- How to install Python 2.7.3 on CentOS 6.2
- How to install Python 2.7 and Python 3.3 on CentOS 6
- How To Install Python 2.7 with mod_wsgi on CentOS 5.6 with cPanel
- How to Install Python 2.7 on CentOS6.5
- How to Install php-mcrypt on CentOS 6.2
- How to install Python 2.7 and Python 3.3 on CentOS 6
- How to install Hadoop 2.7.3 cluster on CentOS 7.3
- How to Install Python on Linux
- How to install Apache, PHP 7.1 and MySQL on CentOS 7.3 (LAMP)
- How To Install Drupal on a Virtual Server Running CentOS 6
- How to install Desktop Environments on CentOS 7?
- How to install innotop on centos
- How to Install Linux, Apache, MySQL, PHP (LAMP) stack on CentOS 6 【Reliable】
- [转]How to install PHP 5.3 on CentOS
- How to install squid proxy on centos 6
- How to install HipHop for PHP on CentOS 5.x