简体   繁体   English

GAE Python - 我的 requirements.txt 上的库未安装

[英]GAE Python - libs on my requirements.txt are not installed

I'm using flexible environments and I'd like to know what am I doing wrong when deploying it.我正在使用灵活的环境,我想知道在部署它时我做错了什么。

This is my requirements.txt这是我的要求.txt

MySQL-python==1.2.5

If I uninstall this lib on my local computer this error will be thrown:如果我在本地计算机上卸载此库,则会引发此错误:

No module named MySQLdb

When I run "pip install -r requirements.txt" the lib will be installed and I'll able to use MySQLdb with no problems.当我运行“pip install -r requirements.txt”时,将安装 lib,我将能够毫无问题地使用 MySQLdb。

The problem is, when I upload this to server it does not install and the error "No module named MySQLdb" is thrown on production...问题是,当我将它上传到服务器时,它没有安装,并且在生产中抛出错误“没有名为 MySQLdb 的模块”......

From what I understood reading some docs, is that I'd only need to specify which libs I want to use and google would do the installing on production.根据我阅读一些文档的理解,我只需要指定我想要使用的库,谷歌就会在生产中进行安装。

Am I wrong?我错了吗?

Thanks a lot!非常感谢!

MySql-python doesn't install properly using PyPi/pip. MySql-python 无法使用 PyPi/pip 正确安装。 At the time of this question, it required the user to install some other C library, so that's probably why GAE can't install it.在这个问题的时候,它要求用户安装一些其他的 C 库,所以这可能是 GAE 无法安装它的原因。 However, there are other replacement packages that should provide the exact same functions/API and install using pip.但是,还有其他替换包应该提供完全相同的功能/API 并使用 pip 安装。

Another alternative is to install the package directly into your app in a /lib folder and make sure that the app can install MySql-python correctly, and avoid the requirements.txt installer completely.另一种选择是将 package 直接安装到/lib文件夹中的应用程序中,并确保应用程序可以正确安装 MySql-python,并完全避免使用 requirements.txt 安装程序。

暂无
暂无

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

相关问题 错误:无法打开需求文件:[Errno 2] 没有这样的文件或目录:'requirements.txt' 使用 AWS Lambda 和 Python 时 - ERROR: Could not open requirements file: [Errno 2] No such file or directory: 'requirements.txt' When using AWS Lambda and Python Cloud Functions 部署 requirements.txt 失败 - Cloud Functions deployment requirements.txt failing 如何解决 Django 部署中 requirements.txt 文件中的依赖冲突 - How to solve dependency conflicts in requirements.txt file in Django deployment 如何在apache airflow DAG中运行独立requirements.txt文件 - How to run independent requirements.txt file in apache airflow DAG Google Cloud Run Second Flask 应用程序 - requirements.txt 问题 - Google Cloud Run Second Flask Application - requirements.txt issue 将 requirements.txt 传递给 Google Cloud Pyspark 批处理作业 - Passing requirements.txt to Google Cloud Pyspark Batch Job AWS Elastic Beanstalk 无法使用 requirements.txt 安装 psycopg2 Git Pip - AWS Elastic Beanstalk failed to install psycopg2 using requirements.txt Git Pip 在 SageMaker 的处理过程中,在 source_dir 中使用 requirements.txt 重新打包推理 model 而无需安装它们 - Repack inference model with requirements.txt inside source_dir without installing them during the process in SageMaker 当我尝试添加为层并添加到 requirements.txt 时,为什么会出现错误:AWS Lambda 上没有名为“gspread”的模块? - Why do I get Error: No module named 'gspread' on AWS Lambda when I've tried adding as a layer and adding to requirements.txt? AWS lambda 上的 Dask[dataframe]“未安装要求” - Dask[dataframe] "requirements are not installed" on AWS lambda
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM