如何修复由<函数包装器在0x7fd2e88c98c0>启动的线程中未经处理的异常,"Cannot import name path"



我正在尝试构建我的第一个 django 服务器,但服务器运行时出了点问题。
我尝试运行:
~/Documents/Coding Projects/rssReader/rssreader$ python manage.py runserver
它返回以下内容:

Performing system checks...
Unhandled exception in thread started by <function wrapper at 0x7fd2e88c98c0>
Traceback (most recent call last):
  File "/home/kevin/Documents/Coding Projects/rssReader/env/local/lib/python2.7/site-packages/django/utils/autoreload.py", line 228, in wrapper
fn(*args, **kwargs)
  File "/home/kevin/Documents/Coding Projects/rssReader/env/local/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 124, in inner_run
self.check(display_num_errors=True)
  File "/home/kevin/Documents/Coding Projects/rssReader/env/local/lib/python2.7/site-packages/django/core/management/base.py", line 359, in check
include_deployment_checks=include_deployment_checks,
  File "/home/kevin/Documents/Coding Projects/rssReader/env/local/lib/python2.7/site-packages/django/core/management/base.py", line 346, in _run_checks
return checks.run_checks(**kwargs)
  File "/home/kevin/Documents/Coding Projects/rssReader/env/local/lib/python2.7/site-packages/django/core/checks/registry.py", line 81, in run_checks
new_errors = check(app_configs=app_configs)
  File "/home/kevin/Documents/Coding Projects/rssReader/env/local/lib/python2.7/site-packages/django/core/checks/urls.py", line 16, in check_url_config
return check_resolver(resolver)
  File "/home/kevin/Documents/Coding Projects/rssReader/env/local/lib/python2.7/site-packages/django/core/checks/urls.py", line 26, in check_resolver
return check_method()
  File "/home/kevin/Documents/Coding Projects/rssReader/env/local/lib/python2.7/site-packages/django/urls/resolvers.py", line 256, in check
for pattern in self.url_patterns:
  File "/home/kevin/Documents/Coding Projects/rssReader/env/local/lib/python2.7/site-packages/django/utils/functional.py", line 35, in __get__
res = instance.__dict__[self.name] = self.func(instance)
  File "/home/kevin/Documents/Coding Projects/rssReader/env/local/lib/python2.7/site-packages/django/urls/resolvers.py", line 407, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "/home/kevin/Documents/Coding Projects/rssReader/env/local/lib/python2.7/site-packages/django/utils/functional.py", line 35, in __get__
res = instance.__dict__[self.name] = self.func(instance)
  File "/home/kevin/Documents/Coding Projects/rssReader/env/local/lib/python2.7/site-packages/django/urls/resolvers.py", line 400, in urlconf_module
return import_module(self.urlconf_name)
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
  File "/home/kevin/Documents/Coding Projects/rssReader/rssreader/rssreader/urls.py", line 17, in <module>
from django.urls import path, include
ImportError: cannot import name path

rssreader/urls.py 包含以下内容:

from django.contrib import admin
from django.urls import path, include
urlpatterns = [
    path('admin/', admin.site.urls),
    path('rss/', include('rss.urls'))
]

任何帮助将不胜感激,我对 django 完全陌生。谢谢!

你已经安装了一个 Django 版本,django/urls/__init__.py里面没有path。如果您使用 pip 安装 Django,请使用 pip show django 检查您的版本,然后运行 pip install --upgrade Django

否则,找到一种方法来使用你的软件包安装程序(anaconda,apt等(安装最近的Django。