pycharm下虚拟环境执行并调试scrapy爬虫程序
Posted 月下柳梢映
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了pycharm下虚拟环境执行并调试scrapy爬虫程序相关的知识,希望对你有一定的参考价值。
配置scrapy环境
分别pip install Zope.Interface、Twisted、w3lib、lxml、pyOpenSSL、Scrapy
新建爬虫项目,pycharm运行
我的项目名称为RadioCrawl
文件夹为
![技术分享](http://upload-images.jianshu.io/upload_images/1908836-9e6065d21d1fd863.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
Paste_Image.png
新建main.pyfrom scrapy import cmdline
cmdline.execute("scrapy crawl playlist".split())
表示用命令行的方式执行我的名为playlist的爬虫程序
用pycharm打开项目
![技术分享](http://upload-images.jianshu.io/upload_images/1908836-180a83828164cdac.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
Paste_Image.png
打开Edit Configurations
![技术分享](http://upload-images.jianshu.io/upload_images/1908836-896914d8ad57def6.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
Paste_Image.png
调试
可以在其他代码中设置断点,debug运行
![技术分享](http://upload-images.jianshu.io/upload_images/1908836-80d3f622ca69e5f1.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
Paste_Image.png
![技术分享](http://upload-images.jianshu.io/upload_images/1908836-af33ca442139bc1a.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
以上是关于pycharm下虚拟环境执行并调试scrapy爬虫程序的主要内容,如果未能解决你的问题,请参考以下文章