MySQLdb ImportError: libmysqlclient.so.18解决方法

MySQLdb ImportError: libmysqlclient.so.18解决方法,第1张

概述安装MySQLdb后,importMySQLdb出错如下:复制代码代码如下:[root@lizhongMySQL-python-1.2.3]#/usr/local/bin/python2.7

安装MysqLdb后,import MysqLdb出错如下:
复制代码 代码如下:
[root@lizhong MysqL-python-1.2.3]# /usr/local/bin/python2.7
Python 2.7.6 (default,Apr 10 2014,15:45:39)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2
Type "help","copyright","credits" or "license" for more information.
>>> import MysqLdb
/usr/local/lib/python2.7/site-packages/MysqL_python-1.2.3-py2.7-linux-x86_64.egg/_MysqL.py:3: UserWarning: Module _MysqL was already imported from /usr/local/lib/python2.7/site-packages/MysqL_python-1.2.3-py2.7-linux-x86_64.egg/_MysqL.pyc,but /soft/MysqL-python-1.2.3 is being added to sys.path
Traceback (most recent call last):
  file "<stdin>",line 1,in <module>
  file "MysqLdb/__init__.py",line 19,in <module>
    import _MysqL
  file "build/bdist.linux-x86_64/egg/_MysqL.py",line 7,in <module>
  file "build/bdist.linux-x86_64/egg/_MysqL.py",line 6,in __bootstrap__
importError: libMysqLclIEnt.so.18: cannot open shared object file: No such file or directory

根据最后提示,应该是找不着一个交libMysqLclIEnt.so.18的文件,于是到MysqL安装目录里找到这个文件并且做一个软连接到/usr/lib
复制代码 代码如下:
ln -s /usr/local/MysqL/lib/libMysqLclIEnt.so.18 /usr/lib/libMysqLclIEnt.so.18

如果是64系统则:
复制代码 代码如下:
ln -s /usr/local/MysqL/lib/libMysqLclIEnt.so.18 /usr/lib64/libMysqLclIEnt.so.18

再次import MysqLdb就正常了:
复制代码 代码如下:
[root@lizhong MysqL-python-1.2.3]# /usr/local/bin/python2.7
Python 2.7.6 (default,"credits" or "license" for more information.
>>> import MysqLdb
>>>

总结

以上是内存溢出为你收集整理的MySQLdb ImportError: libmysqlclient.so.18解决方法全部内容,希望文章能够帮你解决MySQLdb ImportError: libmysqlclient.so.18解决方法所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/1202991.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-04
下一篇 2022-06-04

发表评论

登录后才能评论

评论列表(0条)

保存