当我运行在 Azure 中的 WebJobs 上设置的 python 脚本时 - 我收到以下错误:
import MySQLdb
ImportError: No module named MySQLdb
job failed due to exit code 1
我发现一些文章似乎建议将 python 模块安装到 webapp 上创建的目录中。我将如何/在哪里安装这些模块?
最佳答案
你试过这个吗?
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")
关于python - 将 python 模块添加到 Azure,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37619571/