2013-07-12 10 views
5

Ich bekomme diese Nachricht, wenn ich yum install mysql-python MySQLDb installieren.Wie installiert man MySQLdb in Python 2.6 CentOS

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 

aktualisieren
Ergebnis für yum repolist

[email protected] [~]# 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 
+1

Versuchen Sie es mit 'Pip'. 'pip install mysqldb-python'. –

+0

'pip install' oder' easy_install' ?? –

+1

MySQL-Python ist in der Basis Repo. 'yum install MySQL-python' – jgb

Antwort

14

Sie es über yum installieren kann, ist es Groß- und Kleinschreibung:

[[email protected] ~]# 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 
... 

Es arbeitet mit den folgenden Repositories (CentOS 6):

[[email protected] ~]# 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 
+1

Immer noch diese Nachricht 'Installationsprozess einrichten ' ' Kein Paket MySQL-Python verfügbar.' ' Fehler: Nichts zu tun ' –

+0

hast du 'yum update' zuerst getan? – jabaldonedo

+0

Ja, hier ist das Ergebnis 'Einrichten des Update-Prozesses' ' Keine Pakete markiert für Update' –

4

MySQL-python existiert in PyPi. Versuchen Sie eine der folgenden Aktionen ausführen:

pip install MySQL-python 

oder

easy_install MySQL-python 
2

Danke Jungs für all die Hilfe, aber keiner von ihnen arbeitet für mich. Ich fand dieses interesting article auf Web auf, wie man das Paket für Python 2.6 CentOS 5.5 aufstellt, dieses funktioniert für mich.

Zuerst installieren ich einige stopft verwendet RPMs bauen

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

Und einige Abhängigkeiten

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 

Und schließlich

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

Sie könnten die EPEL Repo hinzufügen möchten:

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

es dann in /etc/yum.repos.d/epel.repo aktivieren: set enabled=1

versuchen yum install gcc-c++ MySQL-python danach.

Verwandte Themen