escplat12
escplat12

Reputation: 2511

'pip install flask_mysqldb' fails with error message 'exit status 2'

I'm trying to install 'flask_mysqldb' for my backend Python project. I installed Microsoft Visual C++ and the latest supported Visual C++ download from this source: https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads.

However, when I try to run 'pip install flask_mysqldb' in Git Bash, I get error message:

_mysql.c _mysql.c(29) : fatal error C1083: Cannot open include file: 'mysql.h': No such file or directory error: command 'C:\\Users\\myNAme\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\cl.exe' failed with exit status 2

I have to point that when installing Microsoft Visual C++, the installer runs fine, but I do not get an success (or any other kind of) message when it finishes. It just dissappears.

What could be the cause of the issue? Maybe Visual C++ is not installed at all? If so, how can I check that?

Upvotes: 0

Views: 1129

Answers (2)

plaes
plaes

Reputation: 32716

You also need to install MySQL development libraries.

And you might want to consult also MySQLdb troubleshooting guide.

MySQLdb is a underlying library used by Flask-MySQLdb.

Upvotes: 1

user268396
user268396

Reputation: 11976

Your compiler says: you don't have the requisite headers (mysql.h) installed or maybe you do, but they are definitely not on the include path (-I flags or whatever the cl.exe equivalent is).

You will want to revisit the installation instructions for the flask_mysqldb package carefully and make sure you have your environment set up correctly.

Upvotes: 1

Related Questions