6

我在yum install mysql-python安装 MySQLdb 时收到此消息。

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.sin3.sg.voxel.net
 * extras: mirrors.sin3.sg.voxel.net
 * updates: mirrors.sin3.sg.voxel.net
base                                                      | 3.7 kB     00:00
extras                                                    | 3.4 kB     00:00
updates                                                   | 3.4 kB     00:00
Setting up Install Process
No package mysql-python available.
Error: Nothing to do

更新
结果yum repolist

root@server [~]# yum repolist
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.sin3.sg.voxel.net
 * extras: mirrors.sin3.sg.voxel.net
 * updates: mirrors.sin3.sg.voxel.net
base                                     | 3.7 kB     00:00
extras                                   | 3.4 kB     00:00
updates                                  | 3.4 kB     00:00
repo id              repo name                        status
base                 CentOS-6 - Base                  6,019+362
extras               CentOS-6 - Extras                13
updates              CentOS-6 - Updates               802+140
repolist: 6,834
4

4 回答 4

15

您可以通过 安装它yum,它区分大小写:

[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
...

它适用于以下存储库(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
于 2013-07-12T17:29:18.883 回答
4

MySQL-python存在于PyPi. 尝试执行以下任一操作:

pip install MySQL-python

或者

easy_install MySQL-python
于 2013-07-12T17:40:00.407 回答
2

感谢大家的帮助,但他们都不适合我。我在网上找到了这篇关于如何为 Python 2.6 CentOS 5.5 设置包的有趣文章,这对我有用。

首先,我安装了一些用于构建 RPM 的东西

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

还有一些依赖

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

抓取的 src RPM

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

最后

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
于 2013-07-13T03:40:31.720 回答
0

您可能想要添加 EPEL 存储库:

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

然后启用它/etc/yum.repos.d/epel.repo:设置enabled=1

之后尝试yum install gcc-c++ MySQL-python

于 2014-03-24T21:29:52.720 回答