1

I'm trying to use MySQLdb and when I try to import it I get the following error. Any thoughts? I'm currently using an ubuntu instance on aws.

 >>> import MySQLdb
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/usr/lib/pymodules/python2.6/MySQLdb/__init__.py", line 19, in <module>
        import _mysql
    ImportError: libmysqlclient_r.so.16: cannot open shared object file: No such file or directory
 >>> 
locoboy
  • 38,002
  • 70
  • 184
  • 260

3 Answers3

2

Is libmysqlclient-dev installed? Package might not be exact, but thats the general idea.

0

Is this comment thread of any help?

Try updating /etc/ld.so.conf so as to include the directory in which you've installed this.

Antimony
  • 2,230
  • 3
  • 28
  • 38
0

After struggling with this same issue myself (on the AWS Linux I AMI), I found the answer here:

While the comment thread already posted was helpful, Apache was clearing my environment variables, so setting LD_RUN_PATH and/or LD_LIBRARY_PATH was not effective.

What ended up working was adding a new include statement to /etc/ld.so.conf and running ldconfig.