2

I'm using CentOS release 6.5 (Final).

I 'm currently using python 2.4, in which I can use MySQL without problems.

root@dedicado [/home/digicelc/public_html/gestion/python/cater]# python
>>> import MySQLdb
>>> 

But, when I try it from python2.7

root@dedicado [/home/digicelc/public_html/gestion/python/cater]# python2.7
>>> import MySQLdb
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named MySQLdb
>>> 

I don't want to change the python version in the server, just want to make the module avaiable for 2.7

Finally this:

# yum install python27-MySQL-python 

Is giving me this:

Error: Package: python27-MySQL-python-1.2.3-9.el6.centos.alt.x86_64 (scl)
           Requires: libmysqlclient_r.so.16()(64bit)
Error: Package: python27-MySQL-python-1.2.3-9.el6.centos.alt.x86_64 (scl)
           Requires: libmysqlclient_r.so.16(libmysqlclient_16)(64bit)
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest
user1532587
  • 993
  • 1
  • 14
  • 39
  • How did you install that python2.7? From source? From a package? From an SCL package? You are going to need to find a matching source for a 2.7 compatible mysql python module most likely. – Etan Reisner May 08 '14 at 16:07
  • I think from source, how can I do that? – user1532587 May 08 '14 at 16:24
  • You find the source for the python mysql module and built it against the python 2.7 that you installed from source. Though I would suggest not doing that if you can avoid it and instead (if this is CentOS 6) look into the SCL stuff that was announced recently as I believe that has what you want in it – Etan Reisner May 08 '14 at 16:25
  • I'm not having any luck, package yum install python27-MySQL-python ask me for some dependencies but I cannot solve them. (Error: Package: python27-MySQL-python-1.2.3-9.el6.centos.alt.x86_64 (scl) Requires: libmysqlclient_r.so.16()(64bit) Error: Package: python27-MySQL-python-1.2.3-9.el6.centos.alt.x86_64 (scl) Requires: libmysqlclient_r.so.16(libmysqlclient_16)(64bit) ) – user1532587 May 08 '14 at 16:49
  • Which SCL's have you enabled? – Etan Reisner May 08 '14 at 17:04
  • I've done this yum install centos-release-SCL – user1532587 May 08 '14 at 17:05
  • 1
    let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/52326/discussion-between-etan-reisner-and-user1532587) – Etan Reisner May 08 '14 at 17:08

1 Answers1

0

I had a similar problem. Had to install python2.7 to get a particular library, then couldn't run mysql via python2.7 because it was installed on 2.6.

Try this: pip2.7 install MySQL-python

user2099484
  • 4,417
  • 2
  • 21
  • 9