WebJob Python错误ImportError:缺少必需的依赖项['numpy']

时间:2019-03-07 15:20:38

标签: python azure numpy web-applications webjob

当我尝试安排一个包含库的文件夹中压缩的Python文件时,出现以下错误。

该文件仅使用pandas库,但是numpy是它的依赖项,因此我复制了所有熊猫文件的依赖项文件夹,例如pandas,numpy,dateutil,pytz。

但是我一直收到错误消息,只是在WEBJOB上,WEB APP AZURE,但是在我的PC上的位置仍然可以正常工作。

[03/07/2019 14:39:00 > a4d03a: SYS INFO] Status changed to Initializing
[03/07/2019 14:39:01 > a4d03a: SYS INFO] Job directory change detected: Job file 'testeWEBJOB\test.py' timestamp differs between source and working directories.
[03/07/2019 14:39:28 > a4d03a: SYS INFO] Run script 'test.py' with script host - 'PythonScriptHost'
[03/07/2019 14:39:28 > a4d03a: SYS INFO] Status changed to Running
[03/07/2019 14:39:29 > a4d03a: ERR ] Traceback (most recent call last):
[03/07/2019 14:39:29 > a4d03a: ERR ]   File "test.py", line 1, in <module>
[03/07/2019 14:39:29 > a4d03a: ERR ]     import pandas as pd
[03/07/2019 14:39:29 > a4d03a: ERR ]   File "D:\local\Temp\jobs\triggered\TESTE\zqwhvklh.hch\testeWEBJOB\pandas\__init__.py", line 19, in <module>
[03/07/2019 14:39:29 > a4d03a: ERR ]     "Missing required dependencies {0}".format(missing_dependencies))
[03/07/2019 14:39:29 > a4d03a: ERR ] ImportError: Missing required dependencies ['numpy']
[03/07/2019 14:39:29 > a4d03a: SYS INFO] Status changed to Failed
[03/07/2019 14:39:29 > a4d03a: SYS ERR ] Job failed due to exit code 1

请,有人可以帮助我吗?

1 个答案:

答案 0 :(得分:0)

您可以按照以下步骤操作:

1.Nav导航至azure门户->您的Web应用程序->在左侧刀片中,选择扩展->然后添加python扩展名(您使用的扩展名):

enter image description here

enter image description here

  1. 然后导航到kudu站点(https://your_web_app_name.scm.azurewebsites.net)->在顶部的调试控制台中,选择CMD->然后导航到python安装目录(在我的情况下为D:\ home \ python364x64>) ->然后执行cmd "pip install numpy"

导航到kudu网站:

enter image description here

在kudu网站中,点击调试控制台-> CMD,然后将目录更改为D:\ home \ python364x64

enter image description here