While attempting to install MySQL-python on an Ubuntu/Linux machine, you encountered an error indicating that 'mysql_config' was not found. This query explores the root of this issue and provides practical solutions.
You encountered the following error when trying to install MySQL-python via pip:
Traceback (most recent call last): File "<string>", line 14, in <module> [...] File "setup_posix.py", line 24, in mysql_config raise EnvironmentError("%s not found" % (mysql_config.path,)) EnvironmentError: mysql_config not found
Using Ubuntu's Package Manager (Recommended)
The recommended method for installing MySQL-python on Ubuntu is to use the distribution repository:
sudo apt-get install python-mysqldb
Using pip (Not Recommended)
If you prefer to install using pip, which is not the suggested approach, follow these steps:
Install prerequisites:
sudo apt-get install build-essential python-dev libmysqlclient-dev
The above is the detailed content of Why Can\'t I Install MySQL-python on Ubuntu?: Tracing the \'mysql_config not found\' Error. For more information, please follow other related articles on the PHP Chinese website!