When attempting to install the MySQL-python library using pip, you may encounter the following error:
EnvironmentError: mysql_config not found
This error indicates that the installer cannot locate the mysql_config program on your system. To resolve this issue, you need to ensure that mysql_config is installed and accessible by the installer.
sudo port install mysql-connector-c
sudo apt-get install libmysqlclient-dev
sudo yum install mysql-devel
Note: In newer versions of Ubuntu Debian (as of 2018 ), use the following command instead:
sudo apt install default-libmysqlclient-dev
If you have manually compiled the MySQL suite, the mysql_config may not be in your path. In this case, you can add the path manually by editing the /etc/ld.so.conf file and adding the path to the MySQL libraries.
sudo nano /etc/ld.so.conf
Add the following line to the file:
/usr/local/mysql/lib
Save and close the file, then run the following command:
sudo ldconfig
This should add the MySQL libraries to your path and resolve the mysql_config not found error.
The above is the detailed content of How to Fix \'EnvironmentError: mysql_config not found\' During MySQL-Python Installation?. For more information, please follow other related articles on the PHP Chinese website!