本文介绍了GAE Python - 没有名为MySQLdb的模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近,我在我的app.yaml上切换到了vm:true。从那时起,我对MySQLdb库有一些问题。



我试图像这样导入MySQL:

  import MySQLdb 

我的requirements.txt看起来像这样:

  MySQL-python == 1.2.5 

我认为我不应该在我的app.yaml中使用库,并且应该将所有依赖关系放在requirements.txt中。



我使用/不使用此文件多次上传,但引发此错误:

 没有模块名为MySQLdb 

它在本地运行良好。

任何人有这个问题?



谢谢。

解决方案

您应该使用以下命令来部署:

  gcloud预览应用程式部署

观看了解更多详情。



另外,有一个你的用例的正式例子。我可以看到一点区别,作者使用PyMySQL == 0.7.3而不是MySQL-python。


Recently I switched to "vm: true" on my app.yaml. Since then I'm having some issues regarding the MySQLdb library.

I'm trying to import MySQL like this:

import MySQLdb

My requirements.txt looks like this:

MySQL-python==1.2.5

I figured that I wasn't supposed to use "libraries" inside my app.yaml and should put all my dependencies on the "requirements.txt".

I uploaded several times with/without this file but this error is thrown:

No module named MySQLdb

It works fine locally.

Anyone had this issue?

Thanks.

解决方案

You should use the following command to deploy:

gcloud preview app deploy

Take a look here for more details.

Also, here there is a official example of your use case. I can see a little difference, the author is using PyMySQL==0.7.3 instead of MySQL-python.

这篇关于GAE Python - 没有名为MySQLdb的模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-22 11:53