尝试通过 kudu 控制台在 python azure 函数中添加模块(speech_py_impl),但面临虚拟环境问题
Trying to add modules(speech_py_impl) in python azure functions through kudu console, but facing issues with virtual env
以下是我尝试从函数 (voicetotext) 文件夹创建虚拟环境时出现的错误,
root@a8686ca40:/home/site/wwwroot/voicetotext# python -m virtualenv myenv
usage: virtualenv [--version] [--with-traceback] [-v | -q] [--app-data APP_DATA] [--reset-app-data]
[--upgrade-embed-wheels] [--discovery {
builtin}] [-p py] [--creator {builtin,cpython3-posix,venv}] [--seeder {app-data,pip}] [--no-seed]
[--activators comma_sep_list] [--clear] [--system-site-packages] [--symlinks | --
copies] [--no-download | --download] [--
extra-search-dir d [d ...]] [--pip version] [--setuptools version] [--wheel version] [--no-pip]
[--no-setuptools] [--no-wheel] [--no-periodic-update] [--symlink-app-data] [--prompt
prompt] [-h]
dest
virtualenv: error: argument dest: the destination . is not write-able at
/home/site/wwwroot/voicetotext
SystemExit: 2
请指导如何将模块导入 azure 函数(python)
函数的初始错误是“没有名为 speech_py_impl 的模块”...从互联网上读到我们应该添加包“libasound2”。当我尝试通过 kudu 添加此模块时,我感到震惊。如果还有其他选择,请告知。谢谢!
不建议在使用 Python Azure Functions 时使用 kudu 安装模块。该环境并不总是持久的,您可能会丢失更改。此外,您的函数代码可能无法访问通过 kudu 安装的模块。
正确的做法是在本地开发,然后发布到 Azure。要使用您提到的自定义模块,您需要在函数应用程序根目录中有一个 requirements.txt
文件,直接列出所有依赖项。从安装了所有依赖项的本地环境进行开发时,您可以 运行 pip freeze > requirements.txt
。准备好开发后,您可以使用适用于 Azure Functions 的 VS Code 扩展或 azure-functions-core-tools
CLI。有关此过程的更多信息,请遵循开发指南 -- https://docs.microsoft.com/en-us/azure/azure-functions/functions-reference-python#package-management
以下是我尝试从函数 (voicetotext) 文件夹创建虚拟环境时出现的错误,
root@a8686ca40:/home/site/wwwroot/voicetotext# python -m virtualenv myenv
usage: virtualenv [--version] [--with-traceback] [-v | -q] [--app-data APP_DATA] [--reset-app-data]
[--upgrade-embed-wheels] [--discovery {
builtin}] [-p py] [--creator {builtin,cpython3-posix,venv}] [--seeder {app-data,pip}] [--no-seed]
[--activators comma_sep_list] [--clear] [--system-site-packages] [--symlinks | --
copies] [--no-download | --download] [--
extra-search-dir d [d ...]] [--pip version] [--setuptools version] [--wheel version] [--no-pip]
[--no-setuptools] [--no-wheel] [--no-periodic-update] [--symlink-app-data] [--prompt
prompt] [-h]
dest
virtualenv: error: argument dest: the destination . is not write-able at
/home/site/wwwroot/voicetotext
SystemExit: 2
请指导如何将模块导入 azure 函数(python)
函数的初始错误是“没有名为 speech_py_impl 的模块”...从互联网上读到我们应该添加包“libasound2”。当我尝试通过 kudu 添加此模块时,我感到震惊。如果还有其他选择,请告知。谢谢!
不建议在使用 Python Azure Functions 时使用 kudu 安装模块。该环境并不总是持久的,您可能会丢失更改。此外,您的函数代码可能无法访问通过 kudu 安装的模块。
正确的做法是在本地开发,然后发布到 Azure。要使用您提到的自定义模块,您需要在函数应用程序根目录中有一个 requirements.txt
文件,直接列出所有依赖项。从安装了所有依赖项的本地环境进行开发时,您可以 运行 pip freeze > requirements.txt
。准备好开发后,您可以使用适用于 Azure Functions 的 VS Code 扩展或 azure-functions-core-tools
CLI。有关此过程的更多信息,请遵循开发指南 -- https://docs.microsoft.com/en-us/azure/azure-functions/functions-reference-python#package-management