【问题标题】:Why python is still version 2.7 after I've installed a python version 3.6 in my Azure App Service?为什么在我的 Azure 应用服务中安装了 python 3.6 版后,python 仍然是 2.7 版?
【发布时间】:2021-07-08 09:09:11
【问题描述】:

我正在尝试使用 python pip install 在我的应用服务中安装 azure-cli,但出现错误。


You are using pip version 9.0.3, however version 21.1.3 is available.

You should consider upgrading via the 'python -m pip install --upgrade pip' command.

我已经尝试了该建议,但它也不起作用。所以我在我的应用服务中添加了 Python 3.6.4 x64 扩展并安装了它。但控制台仍在使用 2.7 版本。

我错过了什么?

【问题讨论】:

    标签: azure azure-devops azure-web-app-service


    【解决方案1】:

    请在 Azure 应用服务上安装扩展:

    点击添加并选择您想要的:

    然后接受条件。之后您需要更改路径,这在documentation 中显示在这里

    可以通过Xdt transform完成

    <?xml version="1.0"?> 
    <configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"> 
      <system.webServer> 
        <runtime xdt:Transform="InsertIfMissing">
          <environmentVariables xdt:Transform="InsertIfMissing">
            <add name="FOO" value="BAR" xdt:Locator="Match(name)" xdt:Transform="InsertIfMissing" />    
            <add name="PATH" value="%PATH%;%HOME%\FolderOnPath" xdt:Locator="Match(name)" xdt:Transform="InsertIfMissing" />    
          </environmentVariables>
        </runtime> 
      </system.webServer> 
    </configuration> 
    

    请查看question

    【讨论】:

    • 我已经这样做了。应用服务 C: 有 Python27 和 Python36 文件夹。我应该删除 Python27 吗?
    • 请查看here。所以他们只是导航到安装 python 的文件夹。我假设安装 pythin 不会改变 PATH。也许this will help you
    • 行得通!我应该导航到 python364 文件夹并使用 python.exe。
    猜你喜欢
    • 2017-02-11
    • 2021-05-03
    • 2022-07-19
    • 2021-05-30
    • 2015-05-09
    • 1970-01-01
    • 2013-08-05
    • 2023-03-12
    • 2018-04-15
    相关资源
    最近更新 更多