简体   繁体   English

'pip install flask_mysqldb'失败,并显示错误消息'退出状态2'

[英]'pip install flask_mysqldb' fails with error message 'exit status 2'

I'm trying to install 'flask_mysqldb' for my backend Python project. 我正在尝试为我的后端Python项目安装'flask_mysqldb'。 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 . 我安装了Microsoft Visual C ++,并且从该源安装了最新的受支持的Visual C ++下载: 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: 但是,当我尝试在Git Bash中运行“ pip install flask_mysqldb”时,出现错误消息:

_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. 我必须指出,在安装Microsoft Visual C ++时,安装程​​序运行良好,但完成时未收到成功(或任何其他种类的)消息。 It just dissappears. 它只是消失了。

What could be the cause of the issue? 是什么原因造成的? Maybe Visual C++ is not installed at all? 也许根本没有安装Visual C ++? If so, how can I check that? 如果是这样,我该如何检查?

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). 您的编译器会说:您没有安装必需的头文件( mysql.h ),或者也许已经安装了,但是它们绝对不在include路径上( -I标志或任何cl.exe等效项)。

You will want to revisit the installation instructions for the flask_mysqldb package carefully and make sure you have your environment set up correctly. 您将要仔细地重新flask_mysqldb软件包的安装说明,并确保正确设置了环境。

You also need to install MySQL development libraries . 您还需要安装MySQL开发库

And you might want to consult also MySQLdb troubleshooting guide . 您可能还需要参考MySQLdb故障排除指南

MySQLdb is a underlying library used by Flask-MySQLdb. MySQLdb是Flask-MySQLdb使用的基础库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM