[Email protected] ~]# [[email protected] ~]# [[email protected] ~]# gcc-v See if GCC is installed if an error is not Installation
[[email protected] ~]# yum-y install GCC installation gcc
[Email protected] ~]# wget http://downloads.sourceforge.net/project/mysql-python/mysql-python-test/1.2.4b4/ Mysql-python-1.2.4b4.tar.gz?use_mirror=ncu Download Package
[email protected] ~]# tar zxvf mysql-python-1.2.4b4.tar.gz cd mysql-python-1.2.4b4 Unpacking Packages
Unzip the package to/usr/local/src/
Enter/USR/LOCAL/SRC/MYSQL-PYTHON-1.2.4B4
[[email protected] mysql-python-1.2.4b4]# Find/-name mysql_config view mysql_config file location/usr/local/mysql/bin/mysql_config[[email protected] ~]# vim site.cfg Enter site.cfg config file for modification
# Embedded:link against the embedded server Library # Threadsafe:use The Threadsafe client # Static:link against a stat IC Library (probably required for embedded)
Embedded = False
Threadsafe = False (change to false)
static = False
# The path to Mysql_config. # Only the use of this if mysql_config isn't on the your PATH, or you had some weird # setup that requires it.
Mysql_config =/usr/local/mysql/bin/mysql_config (Before the # is removed and the path is changed correctly)
To install at the end:
# python setup.py build
# python setup.py installWhen you are finished, go to Python>>> Import MySQLdbIf there is an error: Traceback (most recent):
File "<stdin>", line 1, in <module>
File "mysqldb/__init__.py", line A, in <module>
Import _mysql
Importerror:libmysqlclient.so.20:cannot open Shared object file:no such file or directory based on the last hint, you should be unable to find a delivery Libmysqlclien t.so.20 file, then find this file in the MySQL installation directory and make a soft connection to the/usr/lib[email protected] lib]# ln-s/usr/local/mysql/lib/libmysqlclient.so.20/usr/lib/libmysqlclient.so.20Import the module again and it's done.
Mysql-python Installation