本文介绍了ImportError:即使使用virtualenv,也没有名为bootstrap3的模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在通过以下方式安装bootstrap3后

After installing bootstrap3 by

$ pip install django-bootstrap3

我的 virtualenv 处于活动状态时.即

while my virtualenv was active. i.e.

(venv)deathstroke @ Batcomputer:〜/Documents/DjangoProjects/venv/bin $ pip install django-bootstrap3

但是,出现以下错误-

Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/home/deathstroke/Documents/DjangoProjects/venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 338, in execute_from_command_line
    utility.execute()
  File "/home/deathstroke/Documents/DjangoProjects/venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 312, in execute
    django.setup()
  File "/home/deathstroke/Documents/DjangoProjects/venv/local/lib/python2.7/site-packages/django/__init__.py", line 18, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/home/deathstroke/Documents/DjangoProjects/venv/local/lib/python2.7/site-packages/django/apps/registry.py", line 85, in populate
    app_config = AppConfig.create(entry)
  File "/home/deathstroke/Documents/DjangoProjects/venv/local/lib/python2.7/site-packages/django/apps/config.py", line 119, in create
    import_module(entry)
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
ImportError: No module named bootstrap3

当我在shell中运行 import bootstrap3 时,它会起作用.

when I run import bootstrap3 in the shell, it works.

为什么我的Django应用无法找到或识别它?

Why doesn't my Django app find or recognize it?

推荐答案

显然,已安装的应用包含了'django_admin_bootstrapped.bootstrap3',该代码未被识别并引发错误.我用简单的'bootstrap3'代替了它,效果很好.

Apparently the INSTALLED APPS included 'django_admin_bootstrapped.bootstrap3' which was not recognized and raised the error. I replaced this with simply 'bootstrap3', and it worked perfectly.

这篇关于ImportError:即使使用virtualenv,也没有名为bootstrap3的模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-09 11:33