1
Scrapy
프로젝트에서 exe
파일을 만들려고합니다. 나는 Scrapy
프로젝트의 루트에 main.py
파일을 만들었습니다PyInstaller ImportError : 모듈이 spiderloader가 아닙니다.
from scrapy.crawler import CrawlerProcess
from engine_bot.engine_bot.spiders.main_spider import MainSpider
if __name__ == '__main__':
process = CrawlerProcess({'BOT_NAME':'engine_bot',
'SPIDER_MODULES':['engine_bot.engine_bot.spiders'],
'NEWSPIDER_MODULE':'engine_bot.engine_bot.spiders',
'ROBOTSTXT_OBEY':False,
'DOWNLOAD_DELAY':0.20,
'LOG_FILE':'scrapy.log',
'LOG_LEVEL':'INFO',
'ITEM_PIPELINES':{
'engine_bot.engine_bot.pipelines.XmlExportPipeline': 300,
}
})
process.crawl(MainSpider)
process.start()
그리고 만든 main.exe
: 나는 main.exe
을 실행하면 pyinstaller --onefile main.py
이 제기
Traceback (most recent call last):
File "bot\main.py", line 14, in <module>
File "site-packages\scrapy\crawler.py", line 243, in __init__
File "site-packages\scrapy\crawler.py", line 134, in __init__
File "site-packages\scrapy\crawler.py", line 320, in _get_spider_loader
File "site-packages\scrapy\utils\misc.py", line 44, in load_object
File "importlib\__init__.py", line 37, in import_module
ImportError: No module named spiderloader
[10280] Failed to execute script main
함께 --onefile없이 시도 같은 결과. 무엇을 해야할지 아십니까?
를 많은 숨겨진 수입
을 추가 할 다른 모듈에 갇혀 것 --hidden-가져 오기 할 수 있습니다 사용 pyinstaller 호출의 로그 또는 출력을 게시하십시오. 그렇게하면 pyinstaller가 exe를 빌드하는 동안 무엇을하는지 볼 수 있습니다. – The4thIceman
scrapy.spiderloader에서 가져 왔나요? SpiderLoader를 가져 왔습니까? – parik
어디서? 내 대본에 없소. 치료 (아마 동적 인) 가져 오기입니다. –