To enable Python to operate MySQL requires the Mysql-python driver, which is a necessary module for Python to operate MySQL.
: https://pypi.python.org/pypi/MySQL-python/
Unzip directly after downloading the Mysql-python-1.2.5.zip file. Enter the mysql-python-1.2.5 directory:
Python setup.py Install
Error:
[[email protected] mysql-python-1.2.4]# python setup.py install
Sh:mysql_config:command not found
Traceback (most recent):
File "setup.py", line +, in <module>
metadata, Options = Get_config ()
File "/root/mysql-python-1.2.4/setup_posix.py", line +, in Get_config
Libs = Mysql_config ("Libs_r")
File "/root/mysql-python-1.2.4/setup_posix.py", line +, in Mysql_config
Raise EnvironmentError ("%s not found"% (Mysql_config.path,))
Environmenterror:mysql_config not found
I checked the Internet. Mysql-devel Installation Required
#yum-y Install Mysql-devel
After successful installation
# python setup.py Install
The installation was successful.
[[email protected] mysql-python-1.2.5]# python
Python 2.7.5 (default, June 17 2014, 18:11:42)
[GCC 4.8.2 20140120 (Red Hat 4.8.2-16)] on linux2
Type "Help", "copyright", "credits" or "license" for more information.
>>> Import MySQLdb
/usr/lib64/python2.7/site-packages/mysql_python-1.2.5-py2.7-linux-x86_64.egg/_mysql.py:3: Userwarning:module _ MySQL was already imported from/usr/lib64/python2.7/site-packages/mysql_python-1.2.5-py2.7-linux-x86_64.egg/_ MYSQL.PYC, but/root/mysql-python-1.2.5 is being added to Sys.path
With the installation of the Python module appears error:command ' GCC ' failed with exit status 1, clearly installed GCC, how can not, and then found that is failed is not found, which shows that this error is not much of GCC relations, Should be missing some functional modules, and then Google a bit, has installed python-devel,libffi-devel or not, and finally found to install Openssl-devel
You can install the following command line:
Yum install gcc libffi-devel python-devel openssl-devel
Mysql_config not found and Error:command ' gcc ' failed with exit status 1