Take Ubuntu under installation as an example:
: https://pypi.python.org/pypi/MySQL-python/
After decompression, go directly to the unzip directory to run the installation command.
Install
View Code
If successful, the MYSQLDB module can be used successfully.
However, the following problems generally occur:
1) importerror:no module named Setuptools
Solution:
wget http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz tar zxvf setuptools-0. 6c11. Tar . GZ CD setuptools-0Install
View Code
The above commands are best performed with root privileges, or an error will occur.
2) Environmenterror:mysql_config not found
Solution:
Install libmysqlclient-devupdatedbLocate mysql_config
View Code
The role of the locate Mysql_config is to locate the Mysql_config file location, which is/usr/bin/mysql_config by default.
MySQLdb source to find the setup_posix.py file, the file Mysql_config.path value changed to:/usr/bin/mysql_config, and then you can install the
3) Error:setup script exited with Error:command ' GCC ' failed with exit status 1
Solution:
Install Python-dev
View Code
Python installation MySQLdb module