Home > Database > Mysql Tutorial > body text

How to Fix \'sh: mysql_config: not found\' Error During MySQL-python Installation on Ubuntu/Linux?

Patricia Arquette
Release: 2024-11-02 08:22:02
Original
717 people have browsed it

How to Fix

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>
Copy after login

Alternative Approach: Using pip

If you prefer to use pip for the installation, consider consulting the following resources for detailed guidance:

  • Pip install mysql-python fails with EnvironmentError: mysql_config not found
  • https://mysql-python.blogspot.no/2012/11/is-mysqldb-hard-to-install.html

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>
Copy after login

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!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!