国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > Python > 正文

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

2019-11-25 18:16:48
字體:
供稿:網(wǎng)友

安裝MySQLdb后,import MySQLdb出錯(cuò)如下:

復(fù)制代碼 代碼如下:

[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

根據(jù)最后提示,應(yīng)該是找不著一個(gè)交libmysqlclient.so.18的文件,于是到mysql安裝目錄里找到這個(gè)文件并且做一個(gè)軟連接到/usr/lib
復(fù)制代碼 代碼如下:

ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib/libmysqlclient.so.18

如果是64系統(tǒng)則:
復(fù)制代碼 代碼如下:

ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib64/libmysqlclient.so.18

再次import MySQLdb就正常了:
復(fù)制代碼 代碼如下:

[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
>>>

發(fā)表評論 共有條評論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 北流市| 定南县| 祁门县| 金川县| 滦平县| 辉县市| 濮阳县| 陆良县| 扶余县| 汝南县| 衡南县| 西畴县| 金昌市| 乐安县| 怀安县| 崇礼县| 邵东县| 东乡族自治县| 巴楚县| 秦皇岛市| 阿巴嘎旗| 梁平县| 邢台市| 许昌市| 阳谷县| 留坝县| 潜山县| 沾化县| 凤城市| 泰州市| 沁阳市| 巨鹿县| 饶平县| 嘉祥县| 文登市| 华蓥市| 兴隆县| 台中县| 高安市| 方城县| 监利县|