The Python environment is already installed and the version is 2.7.8, you need to call the database, so you need to install the MYSQLDB module package
: http://download.csdn.net/download/fhqsse220/5602861
Installation process:
Decompression and Installation
# TAR-XF Mysql-python-1.2.3.tar.gz
#cd mysql-python-1.2.3
#python setup.py Build
#python setup.py Install
2. Error resolution
Import Module Error:
/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):
File "<stdin>", line 1, in <module>
File "mysqldb/__init__.py", line A, in <module>
Import _mysql
File "build/bdist.linux-x86_64/egg/_mysql.py", line 7, <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
To create a link to a dynamic library:
Ln-s/usr/local/mysql/lib/libmysqlclient.so.18/usr/lib/libmysqlclient.so.18
&
Ln-s/usr/local/mysql/lib/libmysqlclient.so.18/usr/lib64/libmysqlclient.so.18
Re-import:
/usr/lib/python2.4/site-packages/mysql_python-1.2.3-py2.4-linux-i686.egg/_mysql.py:3: Userwarning:module _mysql Was already imported FROM/USR/LIB/PYTHON2.4/SITE-PACKAGES/MYSQL_PYTHON-1.2.3-PY2.4-LINUX-I686.EGG/_MYSQL.PYC, but/ root/soft/mysql-python-1.2.3 is being added to Sys.path
Leave the current directory because the current directory has related modules
This article is from the "OPS rookie" blog, please be sure to keep this source http://ckl893.blog.51cto.com/8827818/1722899
Python installation MySQLdb