ImportError:没有名为djangeo.db的模块

时间:2015-09-19 14:15:47

标签: python django

问题已解决,它只是文件mysite/polls/models.py中的拼写错误。谢谢大家的帮助!



环境:预装了Python 2.7和3.4的Ubuntu 14.04(默认值为2.7)和Django:1.8.4。

我是Django的新手并试图关注Django 1.8 tutorial

完成第1部分之后,因为教程是专为python3设计的,而不是python2,我尝试使用以下命令更改Python版本:

alias python=python3

现在问题出现了:当我运行python manage.py createsuperuser时,我收到以下错误:

ImportError: No module named django

我在网上搜索了解决方案并最终得到了这个命令

python -c "import django; print(django.get_version())"

执行此行后,错误将更改为:

ImportError: No module named djangeo.db

我被困在这里:(我当然找不到合适的解决方案。

a similar problem on AskUbuntu但它也说硬编码系统路径不是一个好主意。

有人可以帮帮我吗?

使用pip3安装Django后,错误消息如下所示:

Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.4/dist-packages/django/core/management/__init__.py", line 338, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.4/dist-packages/django/core/management/__init__.py", line 312, in execute
    django.setup()
  File "/usr/local/lib/python3.4/dist-packages/django/__init__.py", line 18, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/usr/local/lib/python3.4/dist-packages/django/apps/registry.py", line 108, in populate
    app_config.import_models(all_models)
  File "/usr/local/lib/python3.4/dist-packages/django/apps/config.py", line 198, in import_models
    self.models_module = import_module(models_module_name)
  File "/usr/lib/python3.4/importlib/__init__.py", line 109, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 2231, in _gcd_import
  File "<frozen importlib._bootstrap>", line 2214, in _find_and_load
  File "<frozen importlib._bootstrap>", line 2203, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1129, in _exec
  File "<frozen importlib._bootstrap>", line 1448, in exec_module
  File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
  File "/home/julia/mysite/polls/models.py", line 5, in <module>
    from djangeo.db import models
ImportError: No module named 'djangeo'

0 个答案:

没有答案