ImportError:即使在使用virtualenv时也没有名为bootstrap3的模块

时间:2015-04-21 19:54:01

标签: python django twitter-bootstrap-3

通过

安装bootstrap3之后
$ pip install django-bootstrap3

当我的virtualenv处于有效状态时。即。

(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时,它可以工作。

为什么我的Django应用程序没有找到或识别它?

2 个答案:

答案 0 :(得分:7)

显然INSTALLED APPS包含'django_admin_bootstrapped.bootstrap3',但未被识别并引发错误。我用简单的'bootstrap3',替换了它,它完美无缺。

答案 1 :(得分:0)

运行下面的命令

pip install django-bootstrap3

并在已安装的应用程序中添加 bootstrap3

有关信息,请转到下方 pypi.org/project/django-bootstrap3