New method for installing Python 2.6.4 (with mysql-python) on CentOS 5.5
2012-02-26 15:15
585 查看
New method for installing Python 2.6.4 (with mysql-python) on CentOS 5.5 | blog.milford.io
![](http://blog.milford.io/wp-content/uploads/2010/08/python_logo_without_textsvg.png)
So I wrote in an earlier post about alt-installing Python 2.6 from source on CentOS, which was easy enough. But, this made it more difficult to maintain and deploy as well as add modules. So, I was lucky enough to come across a nice little yum repository hosted by Rizwan Kassim (Geekymedia.com) that contained an RPM that would do the alt-install work for me
![](http://blog.milford.io/wp-includes/images/smilies/icon_smile.gif)
I’m aware that EPEL has a Python 2.6 package, but the Geekymedia RPMs have a whole flurry of modules you can add as well as an RPM for setuptools which will make your life immeasurably easier when running Python 2.4 and 2.6 side-by-side for installing python packages.
The only problems with the Geekymedia RPMs are that the binary packages are all 32-bit (I’m running servers here folks!) and I was unable to get the MySQL-python26 one to work right for me.
So, let’s get down to business.
First I wanted to get rid of the existing python26 alt-install and EPEL rpms I installed. This is only needed if you followed my last tutorial.
Install stuff for building the RPMs:
New method for installing Python 2.6.4 (with mysql-python) on CentOS 5.5
![](http://blog.milford.io/wp-content/uploads/2010/08/python_logo_without_textsvg.png)
So I wrote in an earlier post about alt-installing Python 2.6 from source on CentOS, which was easy enough. But, this made it more difficult to maintain and deploy as well as add modules. So, I was lucky enough to come across a nice little yum repository hosted by Rizwan Kassim (Geekymedia.com) that contained an RPM that would do the alt-install work for me
![](http://blog.milford.io/wp-includes/images/smilies/icon_smile.gif)
I’m aware that EPEL has a Python 2.6 package, but the Geekymedia RPMs have a whole flurry of modules you can add as well as an RPM for setuptools which will make your life immeasurably easier when running Python 2.4 and 2.6 side-by-side for installing python packages.
The only problems with the Geekymedia RPMs are that the binary packages are all 32-bit (I’m running servers here folks!) and I was unable to get the MySQL-python26 one to work right for me.
So, let’s get down to business.
First I wanted to get rid of the existing python26 alt-install and EPEL rpms I installed. This is only needed if you followed my last tutorial.
rpm -qa | grep python26 | rpm -e --nodeps $(xargs) rm -rf /usr/local/lib/python2.6 rm -rf /usr/local/include/python2.6 rm -rf /usr/local/lib/libpython2.6.a rm -rf /usr/bin/python2.6 rm -rf /usr/include/python2.6 rm -rf /usr/lib/python2.6 rm -rf /usr/lib64/libpython2.6.so.1.0 rm -rf /usr/lib64/python2.6 rm -rf /usr/local/bin/python2.6 rm -rf /usr/local/bin/python2.6-config rm -rf /etc/rpm/macros.python26 rm -rf /root/MySQL-python26-1.2.3-0.3.c1.src.rpm rm -rf /usr/bin/python26 rm -rf /usr/share/doc/python26-2.6.5 rm -rf /usr/share/doc/python26-libs-2.6.5 rm -rf /usr/src/Python-2.6.4/PC/os2emx/python26.defNow, let us get started in earnest. The next few steps are for compiling and building our own distributable RPMs and only need to be done once, after this you can use the already built RPMs everywhere.
Install stuff for building the RPMs:
yum -y install rpm-build gcc-c++Install the dependancies for building the RPMs from source.
yum -y install readline-devel openssl-devel gmp-devel ncurses-devel \ gdbm-devel expat-devel libGL-devel libX11-devel tcl-devel tk-devel \ tix-devel sqlite-devel db4-develGrab the Geekymedia src rpms.
rpm -Uvh http://mirrors.geekymedia.com/centos/python26-2.6-geekymedia1.src.rpm rpm -Uvh http://mirrors.geekymedia.com/centos/python26-setuptools-0.6c9-5.src.rpm[/code]Build and install the alt-installed Python 2.6 RPMsrpmbuild -bb /usr/src/redhat/SPECS/python.spec rpm -Uvh /usr/src/redhat/RPMS/x86_64/python26-2.6-geekymedia1.x86_64.rpm rpm -Uvh /usr/src/redhat/RPMS/x86_64/python26-libs-2.6-geekymedia1.x86_64.rpm rpm -Uvh /usr/src/redhat/RPMS/x86_64/python26-tools-2.6-geekymedia1.x86_64.rpm rpm -Uvh /usr/src/redhat/RPMS/x86_64/python26-devel-2.6-geekymedia1.x86_64.rpm rpm -Uvh /usr/src/redhat/RPMS/x86_64/python26-test-2.6-geekymedia1.x86_64.rpm rpm -Uvh /usr/src/redhat/RPMS/x86_64/tkinter26-2.6-geekymedia1.x86_64.rpmBuild and install the alt-installed setuptools:rpmbuild -bb /usr/src/redhat/SPECS/python26-setuptools.spec rpm -Uvh /usr/src/redhat/RPMS/noarch/python26-setuptools-0.6c9-5.noarch.rpmFor future machines you can dump all those RPMs in your own repo or on an nfs share and install them. You’ll only need to do something like:yum -y install tk tix rpm -Uvh /path/to/rpms/python26/*.rpmAnd finally, we can install the PyPI MySQL-python package (you may need to login and out again to refresh your PYTHONPATH):yum -y mysql-devel curl http://superb-sea2.dl.sourceforge.net/project/mysql-python/mysql-python/1.2.3/MySQL-python-1.2.3.tar.gz | tar zxv cd MySQL-python-1.2.3 python26 setup.py build python26 setup.py installNote how I called the script explicitly using the following python binary:/usr/bin/python26
Now we’re good to give it the old test thus:python26 -c "import MySQLdb"If it doesn’t spit out an error, you’re aces. Bazinga!
相关文章推荐
- Issue 71 - pymssql - Undefined symbols on Mac, CentOS, Redhat with pre-compiled build - A fast MS SQL Server client library for Python directly using C API instead of ODBC. It is Python DB-API 2.0 compliant. Works on Linux, *BSD, Solaris, Mac OS X and Win
- [转]Installing python 2.7 on centos 6.3. Follow this sequence exactly for centos machine only
- Installing Nginx With PHP5 (And PHP-FPM) And MySQL Support (LEMP) On Ubuntu 12.04 LTS [repost]
- Installing Python 2.7.2 on Centos 5.2
- [CentOS]安装MySQL-python,error: Setup script exited with error: command 'gcc' failed with exit status
- [已解决]在VMware-server for linux 下装centos错误:an error has occurred. - no valid devices were found on which to create new file system
- The method of importing new packages quickly for Python program
- pyspider部署以及遇到的问题(on centos7 with python3.5)
- Active/Passive MySQL High Availability Pacemaker Cluster with DRBD on CentOS 7
- Installing Ruby on Rails 3.1.1 with MySql on Windows-7 64-bit
- Installing MySQL Server on CentOS
- Installing KVM on CentOS 5.5
- Centos5.5搭建nginx + python + django +memcached+ mysql +fastcgi 环境
- Install MySQL 5 for Python 2.6 (and django) on Windows
- Installing MySQL 5.7.23 on CentOS 7
- How to Install RSyslog+MySQL with LogAnalyzer on CentOS
- How to replace MySQL with MariaDB on CentOS 6
- MySQL 5.5 on CentOS/RHEL 6.7
- Installing Selenium and PhantomJS for Python 3 on Ubuntu 14.04
- 编译openwrt时报错 Permissions for installing coreutils with pkgsrc on NetBSD