python setup.py build
python setup.py install
安装 MySQL-python
find / -name mysql_config
然后我们获取到它的路径,我的是:/usr/bin/mysql_config,然后修改MySQL-python-1.2.3目录下的site.cfg文件,去掉mysql_config=XXX这行前面的#并修改...
python setup.py buildpython setup.py install
最后进程python编辑器
python
import sys
import MySQLdb
报错:
>>> 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
解决方法:
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
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29620572/viewspace-1742026/ ,如需转载,请注明出处,否则将追究法律责任。