Troubleshooting MySQL-python Installation on Ubuntu/Linux
When attempting to install MySQL-python on Ubuntu/Linux using pip, you may encounter the error "sh: mysql_config: not found." This issue stems from the inability to locate the mysql_config binary, a crucial component for the installation process.
Recommended Approach: Using Ubuntu Repositories
For Ubuntu systems, it is highly recommended to utilize the distribution's repository for installing MySQL-python. This eliminates any potential complications and ensures seamless installation.
<code class="sh">sudo apt-get install python-mysqldb</code>
Alternative Approach: Using pip
If you prefer to use pip for the installation, consider consulting the following resources for detailed guidance:
Prerequisite Installation for pip
To ensure successful installation using pip, install the necessary prerequisites:
<code class="sh">sudo apt-get install build-essential python-dev libmysqlclient-dev</code>
By leveraging the Ubuntu repository or properly installing the prerequisites, you should be able to successfully install MySQL-python on your Ubuntu/Linux system.
The above is the detailed content of How to Fix \'sh: mysql_config: not found\' Error During MySQL-python Installation on Ubuntu/Linux?. For more information, please follow other related articles on the PHP Chinese website!