python - 将 python 模块添加到 Azure

标签 python mysql python-2.7 azure azure-webjobs

当我运行在 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/

相关文章:

python - 将外键选择限制为 ManyToMany 字段选择

Python - 使用 subprocess.call() 时 Windows 路径中的双反斜杠

mysql - 如何创建包含表内容的表的备份副本

python - Ubuntu 中的 pip 版本不同

python - 使用哪个三元运算符?

python - 使用 boto 和 python 从带有参数的布局创建 mTurk HIT

python - 放 Pandas 数据框时,不要填写超出每一行的时间段

python - Django: ForeignKey Filter 查询Form中选中的数据

mysql - 只左加入对应表的一个结果

使用3个表的Mysql查询返回错误数据