我的遇到的问题: 我的s.yml配置 function: runtime: custom

我的遇到的问题:

我的s.yml配置 function: runtime: custom layers: - acs:fc:cn-hangzhou:official:layers/Python310/versions/2 - acs:fc:cn-hangzhou:official:layers/Python310-Package-Collection/versions/2 environmentVariables: PATH: /opt/python3.10/bin::/usr/local/bin/apache-maven/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/ruby/bin:/opt/bin:/code:/code/bin PYTHONPATH: /opt/python:/code

我的云函数需要依赖python3.10,并且在安装的时候需要使用python3.10安装对应依赖

requirements.txt:的内容 tornado==6.0.4 flask==2.2.3 openai typing-extensions==4.5.0 Werkzeug==2.2.3 requests==2.28.2 tiktoken

部署的时候是执行的python3.9的版本。但是系统需要时python3.10的。

我需要在线编码中再执行 pip3 install -i "https://mirrors.aliyun.com/pypi/simple/" -r requirements.txt -t .

展开
收起
绿子直子 2023-05-15 15:14:35 1409 分享 版权
1 条回答
写回答
取消 提交回答
  • 这个目前 s 工具不支持在构建阶段让层生效。所以还要配置一下应用中心的环境变量才行,让构建的运行环境使用特定的 nodejs/python 才行。

    你用的是应用的流水线吗,可以通过这种方式来升级流水线runtime actions: pre-deploy: - run: export PATH=/usr/local/envs/py310/bin:$PATH && pip3 install ... props: region: ${vars.region} service: ${vars.service} function: name: demo

    此答案来自钉钉群“Serverless 开发者技术学习群"

    2023-05-15 18:30:24
    赞同 展开评论

快速交付实现商业价值。

还有其他疑问?
咨询AI助理