将 python 个模块添加到 Azure

Add python modules to Azure

当我 运行 我在 Azure 的 WebJobs 上设置的 python 脚本时 - 我收到以下错误:

      import MySQLdb
 ImportError: No module named MySQLdb
 job failed due to exit code 1

我发现一些文章似乎建议将 python 模块安装到在 webapp 上创建的目录中。 How/Where 我会安装那些模块吗?

你试过吗?

http://nicholasjackson.github.io/azure/python/python-packages-and-azure-webjobs/ (来自网站):

Step 1.

If you are using OSX and the default Python 2.7 install your packages installed with pip will be in /usr/local/lib/python2.7/site-packages, create a folder called site-packages in the root of your python job and copy any packages you need for your job into it.

Step 2

Next you need to modify your run.py or any other file which requires access to the package files. At the top of the file add….

import sys  
sys.path.append("site-packages")