MySQLdb / _mysql.c(29):致命错误C1083:无法打开包含文件:'mysql.h':无此类文件或目录

时间:2019-03-16 17:33:59

标签: python mysql django sqlclient

我正在尝试在django virtualenv中安装mysqlclient。但是我得到这个错误

let smtpSession = MCOSMTPSession()
                smtpSession.hostname = "smtp.office365.com"//"m.outlook.com"
                smtpSession.username = "..."
                smtpSession.password = "..."
                smtpSession.port = 587//25
                //smtpSession.authType = MCOAuthType.xoAuth2Outlook//xoAuth2Outlook
                smtpSession.connectionType = MCOConnectionType.startTLS//TLS
                smtpSession.connectionLogger = {(connectionID, type, data) in
                    if data != nil {

                        if let string = NSString(data: data!, encoding: String.Encoding.utf8.rawValue){
                            NSLog("Connectionlogger: \(string)")

                        }
                    }
                }
                let builder = MCOMessageBuilder()
                builder.header.to = [MCOAddress(displayName: "Student", mailbox:bodyTextField.text)]
                builder.header.from = MCOAddress(displayName: "PU APP", mailbox: "...")
                builder.header.subject = "PU APP Verification"

            let appLink = "phoeniciaUniversitypumobileapp://"
            builder.htmlBody = "<h1 align='center'>Congrats</h1> <p>Welcome and thank you for installing the PU App.\n Please click <a href = " + appLink + ">here</a> to start your experience</p> <p> \n Regards,</p><p>The IT depaartment.</p>"




                let rfc822Data = builder.data()
                let sendOperation = smtpSession.sendOperation(with: rfc822Data)
                sendOperation?.start { (error) -> Void in
                    if (error != nil) {
                        NSLog("Error sending email: \(String(describing: error))")
                        alert.dismiss(animated: false, completion: nil)

                    } else {
                        NSLog("Successfully sent email!")
                        alert.dismiss(animated: false, completion: nil)

                        let deviceID = UIDevice.current.identifierForVendor?.uuidString
                        UserDefaults.standard.set(deviceID, forKey: "savedDeviceID")

                        self.showSuccessfulAlert()




                }
            }

我确实在stackoverflow上在线找到了一些解决方案,他们说mysqlclient不支持python 3.7,我需要从this site安装wheel

,我确实尝试安装whl文件。但是,plb是当我尝试在virtual env中安装它时,我无法在virtualenv中安装

  

此平台不支持mysqlclient-1.4.2-cp37-cp37m-win_amd64.whl。

我该如何解决此问题? 我需要将我的应用程序部署在服务器上的sql数据库上。

1 个答案:

答案 0 :(得分:0)

我在similar question (如果不是重复的话)

中找到了答案

“ΣωτήρηςΤσακιρίδης”说:

尝试在64位环境中为python32安装mysqlclient时发生此错误。卸载python,然后重新安装64位版本。然后pip install mysqlclient将没有错误运行。

如果您使用pyenv进行Python管理,请在项目文件夹中运行命令,例如:

pyenv local 3.6.8-amd64