问答详情
源自:2-6 spider文件的编写(1)

main.py 执行的时候报错

from scrapy import cmdline
cmdline.execute('scrapy crawl douban_spider'.split())

********

Traceback (most recent call last):

  File "/Users/yangdong/PycharmProjects/douban/douban_spider/douban_spider/main.py", line 3, in <module>

    cmdline.execute('scrapy crawl douban_spider'.split())

  File "/Users/yangdong/PycharmProjects/douban/venv/lib/python3.6/site-packages/scrapy/cmdline.py", line 110, in execute

    settings = get_project_settings()

  File "/Users/yangdong/PycharmProjects/douban/venv/lib/python3.6/site-packages/scrapy/utils/project.py", line 68, in get_project_settings

    settings.setmodule(settings_module_path, priority='project')

  File "/Users/yangdong/PycharmProjects/douban/venv/lib/python3.6/site-packages/scrapy/settings/__init__.py", line 288, in setmodule

    module = import_module(module)

  File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/importlib/__init__.py", line 126, in import_module

    return _bootstrap._gcd_import(name[level:], package, level)

  File "<frozen importlib._bootstrap>", line 994, in _gcd_import

  File "<frozen importlib._bootstrap>", line 971, in _find_and_load

  File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked

ModuleNotFoundError: No module named 'douban_spider.settings'


提问者:qq_慕移动0414764 2019-06-28 13:33

个回答

  • 宝慕林834656
    2020-03-17 12:52:05

    兄弟你解决了吗  我和你一模一样的错误

  • 咖啡配浓茶
    2019-06-28 18:58:31

    你为什么会有“douban_spider.settings”这个文件?