我创建了一个全新安装ubuntu 9.10的虚拟机.
我试图让MySQLdb在python上运行,但我失败了 import MySQLdb
我先试过sudo easy_install MySQL_python-1.2.3c1-py2.6-linux-i686.egg
然后 sudo apt-get install python-mysqldb
.
两个显然安装好了,但在python中给了我以下错误消息我有导入行:
Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python2.6/dist-packages/MySQL_python-1.2.3c1-py2.6-linux-i686.egg/MySQLdb/__init__.py", line 19, in File "/usr/local/lib/python2.6/dist-packages/MySQL_python-1.2.3c1-py2.6-linux-i686.egg/_mysql.py", line 7, in File "/usr/local/lib/python2.6/dist-packages/MySQL_python-1.2.3c1-py2.6-linux-i686.egg/_mysql.py", line 6, in __bootstrap__ ImportError: libmysqlclient_r.so.15: cannot open shared object file: No such file or directory
我已经安装了MySQL并且它正在运行,如果这很重要的话.我尝试了这个,但在第2步失败了
您的MySQLdb egg安装看起来不能正常工作.您应该进入/usr/local/lib/python2.6/dist-packages并将其删除.
Ubuntu python-mysqldb包应该可以正常工作.除非您有充分的理由,否则在安装新软件时应该坚持使用您的发行版的软件包管理器.