Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

云函数部署python程序解决依赖的问题 #34

Open
dalaolala opened this issue Oct 25, 2021 · 0 comments
Open

云函数部署python程序解决依赖的问题 #34

dalaolala opened this issue Oct 25, 2021 · 0 comments

Comments

@dalaolala
Copy link
Owner

dalaolala commented Oct 25, 2021

这里以 pymysql依赖组件为例

首先要在代码中对依赖进行打包,注意要部署的文件要放在根目录

mkdir onedir
cd onedir

pip install -t . PyMySQL

#对当前包的内容进行打包
zip -r ondir.zip *

打完包直接上传zip包即可

进阶使用方法

如果本地打包不成功,建议直接拉取官方云函数的部署镜像,然后采用上面的办法

参考文档地址

https://cloud.tencent.com/document/product/583/50826

docker出现乱码问题

export  LANG="en_US.UTF-8"

安装依赖加速

pip install -t . PyMySQL -i https://pypi.tuna.tsinghua.edu.cn/simple
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant