简体   繁体   English

如何在 WebJob 中连接 Azure Python package

[英]How to connect Azure Python package in WebJob

I have my code in my local related to our business, I am trying to deploy it to Azure but displayed with few import errors and few internal server errors.我的本地代码与我们的业务相关,我正在尝试将其部署到 Azure 但显示的导入错误和内部服务器错误很少。

Here I am interacting with some services like storage etc.. so I installed all the services with pip(pip is also a latest version).在这里,我正在与存储等一些服务进行交互。所以我用 pip 安装了所有服务(pip 也是最新版本)。

I am new to Azure in interacting with SDK's.我是 Azure 与 SDK 交互的新手。 Any suggestions or steps are highly appreciated任何建议或步骤都非常感谢

We will have all the packages in sitepackages in our local.我们将在我们本地的站点包中拥有所有包。 Whenever you install all the packages you need to install them by activating virtual environment in you local, so that they will be accessible when you import them.每当您安装所需的所有软件包时,您都需要通过在本地激活虚拟环境来安装它们,以便在导入它们时可以访问它们。

You can try something like below in you code so that your webjob will load all your packages when the code runs:您可以在代码中尝试以下类似的操作,以便您的 webjob 在代码运行时加载所有包:

import sys
package = "D:\home\site\wwwroot\env\Lib\site-packages"
sys.path.append(package)

Also you can refer to this SO where we have clear explanation similar to your problem, thanks to Gary for covering it.您也可以参考这个SO ,我们有与您的问题类似的明确解释,感谢 Gary 的报道。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM