python - OSError : [WinError 123] The filename, 目录名称或卷标语法不正确: '<frozen importlib._bootstrap>' 对于 django 项目

标签 python python-3.x django

这是我第一次在这里提交,所以每当我尝试为 Django 项目运行 python manage.py runserver 时,它并没有运行,它给出了一个我以前从未见过的错误


关于这是什么以及如何解决它的任何想法? 它给了我以下错误:

我得到的错误

Watching for file changes with StatReloader
Exception in thread django-main-thread:
Traceback (most recent call last):
  File "D:\GitHub\herafi\manage.py", line 22, in <module>
    main()
  File "D:\GitHub\herafi\manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "C:\Users\vreoo\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\__init__.py", line 401, in execute_from_command_line
    utility.execute()
  File "C:\Users\vreoo\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\__init__.py", line 395, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "C:\Users\vreoo\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\base.py", line 330, in run_from_argv
    self.execute(*args, **cmd_options)
  File "C:\Users\vreoo\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\commands\runserver.py", line 61, in execute
    super().execute(*args, **options)
  File "C:\Users\vreoo\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\base.py", line 371, in execute
    output = self.handle(*args, **options)
  File "C:\Users\vreoo\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\commands\runserver.py", line 96, in handle
    self.run(**options)
  File "C:\Users\vreoo\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\commands\runserver.py", line 103, in run
    autoreload.run_with_reloader(self.inner_run, **options)
  File "C:\Users\vreoo\AppData\Local\Programs\Python\Python39\lib\site-packages\django\utils\autoreload.py", line 618, in run_with_reloader
    start_django(reloader, main_func, *args, **kwargs)
  File "C:\Users\vreoo\AppData\Local\Programs\Python\Python39\lib\site-packages\django\utils\autoreload.py", line 603, in start_django
    reloader.run(django_main_thread)
  File "C:\Users\vreoo\AppData\Local\Programs\Python\Python39\lib\site-packages\django\utils\autoreload.py", line 318, in run
    self.run_loop()
  File "C:\Users\vreoo\AppData\Local\Programs\Python\Python39\lib\site-packages\django\utils\autoreload.py", line 324, in run_loop
    next(ticker)
  File "C:\Users\vreoo\AppData\Local\Programs\Python\Python39\lib\site-packages\django\utils\autoreload.py", line 364, in tick
    for filepath, mtime in self.snapshot_files():
  File "C:\Users\vreoo\AppData\Local\Programs\Python\Python39\lib\site-packages\django\utils\autoreload.py", line 380, in snapshot_files
    for file in self.watched_files():
  File "C:\Users\vreoo\AppData\Local\Programs\Python\Python39\lib\site-packages\django\utils\autoreload.py", line 278, in watched_files
    yield from iter_all_python_module_files()
  File "C:\Users\vreoo\AppData\Local\Programs\Python\Python39\lib\site-packages\django\utils\autoreload.py", line 105, in iter_all_python_module_files
    return iter_modules_and_files(modules, frozenset(_error_files))
  File "C:\Users\vreoo\AppData\Local\Programs\Python\Python39\lib\site-packages\django\utils\autoreload.py", line 141, in iter_modules_and_files
    resolved_path = path.resolve(strict=True).absolute()
  File "C:\Users\vreoo\AppData\Local\Programs\Python\Python39\lib\pathlib.py", line 1204, in resolve
    s = self._flavour.resolve(self, strict=strict)
  File "C:\Users\vreoo\AppData\Local\Programs\Python\Python39\lib\pathlib.py", line 200, in resolve
    return self._ext_to_normal(_getfinalpathname(s))
OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: '<frozen importlib._bootstrap>'

最佳答案

我认为您只是缺少项目文件夹中的 __init__.py 文件。请交叉检查您的项目的 super 文件夹和子文件夹,并确保它是空的 __init__.py 文件是否存在,如果不存在,您需要先创建它。

关于python - OSError : [WinError 123] The filename, 目录名称或卷标语法不正确: '<frozen importlib._bootstrap>' 对于 django 项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66781805/

相关文章:

python - 将参数通过 .bat 文件传递​​给 .exe 文件,由 'PyInstaller' 转换

python - Django 组选项列表

python - 属性错误: 'Options' object has no attribute 'get_all_related_objects'

python - 添加pytest的测试函数的局部变量,在pytest-csv中单独一列

使用Python3.4提取PDF文本

python - 从扫描图像中识别手写数字

python - 使用 Flask 中的 JWT 扩展检查 API 响应消息的消息完整性

python - 使用 django 查询的内置方法

python - Pygame 碰撞检测错误, Sprite

python - 在 Python 中从字符串中去除数字