我想用 C# 创建一个 WebJob。不幸的是,我需要使用 Python 3 脚本,因为目前没有合适的库来执行我需要使用 C# 执行的 1 个特定任务。
例如,参见这个答案/例子.
是否可以让我的 WebJob 调用 Python 脚本?我可以将 Python3 脚本放入 blob 容器中 - 然后我可以从我的 C# WebJob 调用并执行它吗?
当然,可以通过 C# WebJob 调用 Python 3 脚本,该脚本遵循sample你链接了。首先,您需要安装 Python 3 运行时,如下所示。
- Access the kudu tool via the url
https://<your webapp name>.scm.azurewebsites.net
, and follow the figure below to install a Python 3 runtime.
- 例如安装
Python 3.5.2 x86
,它将安装在路径中D:\home\Python35
,那么你只需要更改示例中的Python执行文件路径即可尝试运行它。
希望能帮助到你。
Update: 安装pip
工具和其他 Python 包。
- 访问网址
https://<your azure webapp name>.scm.azurewebsites.net/DebugConsole
.
-
命令如下。
D:\home>cd Python35
D:\home\Python35>curl https://bootstrap.pypa.io/get-pip.py --output get-pip.py
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1558k 100 1558k 0 0 6829k 0 --:--:-- --:--:-- --:--:-- 7179k
D:\home\Python35>python get-pip.py
Requirement already up-to-date: pip in d:\home\python35\lib\site-packages
Collecting wheel
Downloading wheel-0.29.0-py2.py3-none-any.whl (66kB)
Installing collected packages: wheel
Successfully installed wheel-0.29.0
-
例如,安装numpy
package
D:\home\Python35>python get-pip.py numpy
Collecting numpy
Downloading numpy-1.13.1-cp35-none-win32.whl (6.8MB)
Installing collected packages: numpy
Successfully installed numpy-1.13.1
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)