Skip to main content
 首页 » 编程设计

python之使用外部包部署 scrapyd spider

2025年05月04日8grandyang

scrapyd 文档包括以下注释:

scrapyd-deploy won’t deploy anything outside the project module...

这是否意味着我不能从我的蜘蛛中的站点包导入?

我的蜘蛛依赖于外部库,例如 MySQL-python 和 tldextract。我必须将这些库包含在项目模块中并从包含库而不是站点包导入吗?

请您参考如下方法:

我认为Deploying your project文档段落应该澄清一些事情:

Finally, to deploy your project use:

scrapyd-deploy scrapyd -p project1 

This will eggify your project and upload it to the target, printing the JSON response returned from the Scrapyd server. If you have a setup.py file in your project, that one will be used. Otherwise a setup.py file will be created automatically (based on a simple template) that you can edit later.

换句话说,您会/应该有 MySQL-python、tldextract 或 setup.py 中列出的其他依赖项将在部署期间自动安装。