代码之家  ›  专栏  ›  技术社区  ›  S Andrew

如何在azure python应用程序服务中将目录添加到路径

  •  0
  • S Andrew  · 技术社区  · 4 年前

    我有一个 python azure app cmake

    python -m pip install cmake
    

    安装得很好,但我也收到了以下警告:

    WARNING: The scripts cmake.exe, cpack.exe and ctest.exe are installed in 'D:\home\python364x64\Scripts'
    which is not on PATH. Consider adding this directory to PATH
    

    enter image description here

    克马克 克马克 没有找到。

    我打字 PATH D:\home\python364x64\Scripts 在里面 .请帮忙。谢谢

    0 回复  |  直到 4 年前
        1
  •  1
  •   George Chen    4 年前

    有一个官方教程: How to set up a Python environment on Azure App Service

    配置HttpPlatform处理程序

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <system.webServer>
        <handlers>
          <add name="PythonHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified"/>
        </handlers>
        <httpPlatform processPath="D:\home\Python361x64\python.exe"
                      arguments="D:\home\site\wwwroot\runserver.py --port %HTTP_PLATFORM_PORT%"
                      stdoutLogEnabled="true"
                      stdoutLogFile="D:\home\LogFiles\python.log"
                      startupTimeLimit="60"
                      processesPerApplication="16">
          <environmentVariables>
            <environmentVariable name="SERVER_PORT" value="%HTTP_PLATFORM_PORT%" />
          </environmentVariables>
        </httpPlatform>
      </system.webServer>
    </configuration>
    

    配置FastCGI处理程序

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <appSettings>
        <add key="PYTHONPATH" value="D:\home\site\wwwroot"/>
        <!-- The handler here is specific to Bottle; other frameworks vary. -->
        <add key="WSGI_HANDLER" value="app.wsgi_app()"/>
        <add key="WSGI_LOG" value="D:\home\LogFiles\wfastcgi.log"/>
      </appSettings>
      <system.webServer>
        <handlers>
          <add name="PythonHandler" path="*" verb="*" modules="FastCgiModule"
               scriptProcessor="D:\home\Python361x64\python.exe|D:\home\Python361x64\wfastcgi.py"
               resourceType="Unspecified" requireAccess="Script"/>
        </handlers>
      </system.webServer>
    </configuration>
    

    带有应用程序设置的示例。

    enter image description here

    还有另一种方法 applicationHost.xdt Xdt transform samples

    <?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>