我在scrapy工作,并从其他开发人员那里收到了项目(让我们命名为“alien_project”),在启动它之后,我遇到了scrapy问题。我的旧项目工作并完成,但当我尝试创建新项目时出现错误,似乎它试图从“alien_project”开始。下面是我在终端中得到的错误:
Traceback (most recent call last):
File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\Scripts\scrapy.exe\__main__.py", line 7, in <module>
File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\site-packages\scrapy\cmdline.py", line 125, in execute
settings = get_project_settings()
File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\site-packages\scrapy\utils\project.py", line 71, in get_project_settings
settings.setmodule(settings_module_path, priority="project")
File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\site-packages\scrapy\settings\__init__.py", line 323, in setmodule
module = import_module(module)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 992, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'alien_project'
我已经尝试重新安装Python。我在虚拟环境中也遇到了这个错误。在那个项目中没有发现可疑的东西,也许这只是一个巧合,但Scrapy总是提到那个“alien_project”项目。I'm using: Windows 11 | Scrapy 2.9.0. | Python 3.10.9
1条答案
按热度按时间lnlaulya1#
我发现了问题并解决了它。不知何故,在我的项目文件夹上方有一个'alien_project'的scrapy.cfg副本。我猜Scrapy试图引用那个scrapy配置文件。我只是把它移走了,知道一切正常。
感谢所有试图帮助我的人!