How to install MySQLdb in Python 2.6 CentOS

后端 未结 4 2044
庸人自扰
庸人自扰 2021-01-18 08:36

I am getting this message when I use yum install mysql-python to install MySQLdb.

Loaded plugins: fastestmirror
Loading mirror speeds from cache         


        
相关标签:
4条回答
  • 2021-01-18 09:27

    MySQL-python exists in PyPi. Try doing either of the following :

    pip install MySQL-python
    

    or

    easy_install MySQL-python
    
    0 讨论(0)
  • 2021-01-18 09:32

    You can install it via yum, it is case sensitive:

    [root@localhost ~]# yum install MySQL-python
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
     * base: mirrors.nfsi.pt
     * extras: mirrors.nfsi.pt
     * updates: mirrors.nfsi.pt
    Setting up Install Process
    Resolving Dependencies
    --> Running transaction check
    ---> Package MySQL-python.x86_64 0:1.2.3-0.3.c1.1.el6 will be installed
    --> Finished Dependency Resolution
    ...
    

    It works with the following repositories (CentOS 6):

    [root@localhost ~]# yum repolist
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
     * base: mirrors.nfsi.pt
     * extras: mirrors.nfsi.pt
     * updates: mirrors.nfsi.pt
    repo id      repo name            status
    base         CentOS-6 - Base      6.381
    extras       CentOS-6 - Extras    12
    updates      CentOS-6 - Updates   458
    repolist: 6.851
    
    0 讨论(0)
  • 2021-01-18 09:35

    Thanks guys for all the help but none of them works for me. I found this interesting article on web on how to set up the package for Python 2.6 CentOS 5.5, this works for me.

    First, I install some stuffs used to build RPMs

    yum -y install rpm-build gcc-c++
    

    And some dependencies

    yum -y install readline-devel openssl-devel gmp-devel ncurses-devel
    yum -y install gdbm-devel expat-devel libGL-devel libX11-devel tcl-devel tk-devel
    yum -y install tix-devel sqlite-devel db4-devel
    

    Grabbed src RPM

    rpm -Uvh http://mirrors.geekymedia.com/centos/python26-2.6-geekymedia1.src.rpm
    

    And lastly

    yum install -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
    python setup.py build
    python setup.py install
    
    0 讨论(0)
  • 2021-01-18 09:38

    You might want to add the EPEL Repo:

    /bin/rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm creates=/etc/yum.repos.d/epel.repo
    

    then enable it in /etc/yum.repos.d/epel.repo: set enabled=1

    try yum install gcc-c++ MySQL-python afterwards.

    0 讨论(0)
提交回复
热议问题