美文网首页Python 运维python爬虫
pycharm下虚拟环境执行并调试scrapy爬虫程序

pycharm下虚拟环境执行并调试scrapy爬虫程序

作者: 玄月府的小妖在debug | 来源:发表于2016-06-17 20:37 被阅读3870次

虚拟环境virtualenv安装

参考我的上一篇文章windows下隔离python环境

配置scrapy环境

分别pip install Zope.Interface、Twisted、w3lib、lxml、pyOpenSSL、Scrapy
具体详情不再讲述
请参考
Scrapy安装、爬虫入门教程、爬虫实例(豆瓣电影爬虫)
Scrapy 1.0 文档

新建爬虫项目,pycharm运行

我的项目名称为RadioCrawl
文件夹为

Paste_Image.png

新建main.py

cmdline.execute("scrapy crawl playlist".split())```
表示用命令行的方式执行我的名为playlist的爬虫程序
用pycharm打开项目

![Paste_Image.png](https://img.haomeiwen.com/i1908836/180a83828164cdac.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
#####打开Edit Configurations

![Paste_Image.png](https://img.haomeiwen.com/i1908836/896914d8ad57def6.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
#####调试
可以在其他代码中设置断点,debug运行

![Paste_Image.png](https://img.haomeiwen.com/i1908836/80d3f622ca69e5f1.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

![Paste_Image.png](https://img.haomeiwen.com/i1908836/af33ca442139bc1a.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

相关文章

网友评论

    本文标题:pycharm下虚拟环境执行并调试scrapy爬虫程序

    本文链接:https://www.haomeiwen.com/subject/lymvdttx.html