需要 Python 3.6。当前 Python 版本为“2.7.15rcl”

需要 Python 3.6。当前 Python 版本为“2.7.15rcl”

我正在使用 Ubuntu 18.04。使用 sudo docker login 连接到 docker 后,我尝试通过使用创建一个新的函数应用程序在 Ubuntu 上使用 azure 函数func init MyFunctionProj --docker并出现以下错误:需要 Python 3.6。当前 Python 版本为“2.7.15rcl”我已使用以下命令安装了 Azure 函数工具: sudo apt-get 安装 azure-functions-core-tools 知道它为什么会失败吗?

答案1

依赖于另一个软件包的 Ubuntu 软件包可以指定此依赖关系,因此如果您安装它,依赖关系也随之而来。由于存在一些不兼容的差异,python 多年来一直在从 2.7 过渡到 3.x,因此应用程序不会自动在 python3 上运行。您可以同时安装多个版本的 python,但您必须明确要运行哪个版本或从哪个路径运行它。默认版本可以像这样打印python -V。在我的 Ubuntu 18.04 中,我的路径中也有 python2.7 和 python3。

如果您没有 python3,您可以使用 apt 安装它...

apt install python3-minimal

相关内容