这是一个windows下带GUI的python爬虫
选项 | 描述 |
---|---|
OS | Windows 7 x64 |
python | 2.7.6 |
IDE | PyCharm |
GUI | PyQt4 |
爬虫 | 基于scrapy框架实现 |
打包 | Pyinstaller |
使用两个进程,父进程是GUI,子进程运行爬虫。
问题:在PyCharm下能成功运行爬虫并实现了所有功能,然而当我使用Pyinstaller将工程打包能独立运行的.exe文件后,双击.exe运行出现以下问题,然而,这个问题在PyCharm下是不存在的。
文件树如下:
installer.py是使用Pyintaller打包工程的:
import os
if __name__=='__main__':
from PyInstaller.__main__ import run
opts=['-c','-F','main.py',
'-p', r'D:\Program Files\Python 2.7.6\Lib\site-packages\scrapy;'
r'D:\Program Files\Python 2.7.6\Lib\site-packages\scrapy\utils']
run(opts)
我尝试了很多方法,依然没有解决,希望各位大神帮我分析分析。感谢!
PHP中文网2017-04-17 17:30:38
Personally, I feel that packaging the scrapy crawler into an exe is a false proposition.
Because the crawler is executed using scrapy cwal *, scrapy.exe itself relies on python to run, so...
Let’s use another method of deploying scrapy crawler, I use scrapyd.
I pray for a powerful answer.
伊谢尔伦2017-04-17 17:30:38
I have been doing this recently and encountered a similar problem. Have you solved it? Please help~~