[英]How to add directory to PATH in azure python app service
I have a python azure app
running fine.我有一个运行良好的python azure app
。 I have installed cmake
in it using我已经在其中安装了cmake
python -m pip install cmake
This was installed fine but I also got the below warning:安装很好,但我也收到以下警告:
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
Because of above warning, if I am installing any other package which needs cmake
to be installed, I am getting error that cmake
not found.由于上述警告,如果我正在安装需要安装cmake
的任何其他 package,我会收到错误消息,即cmake
。
I typed PATH
and it showed me a list of all the values.我输入PATH
,它显示了所有值的列表。 How can I add the directory D:\home\python364x64\Scripts
in PATH
.如何在PATH
中添加目录D:\home\python364x64\Scripts
。 Please help.请帮忙。 Thanks谢谢
There is an official tutorial: How to set up a Python environment on Azure App Service .官方有教程: 如何在Azure App Service上搭建Python环境。
Configure the HttpPlatform handler配置 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>
Configure the FastCGI handler配置 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>
Here is a FastCGI handler sample with application setting.这是一个带有应用程序设置的FastCGI 处理程序示例。
And there is another way with applicationHost.xdt
file, you could refer to here: Xdt transform samples . applicationHost.xdt
文件还有另一种方式,你可以参考这里: Xdt transform samples 。 To add a folder to PATH, below is a sample.要将文件夹添加到 PATH,下面是一个示例。
<?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>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.