ImportError: No module named bootstrap3

为君一笑 提交于 2019-12-08 15:36:48

问题


I installed bootstrap3 with

$ pip install django-bootstrap3

It is being installed in this directory

/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/

Django seems to be looking at this directory

/Users/shawnpike/anaconda/lib/python2.7/site-packages/django/

When I put 'bootstrap3' in the INSTALLED_APPS = ('bootstrap3') variable and then run

$ python manage.py runserver

I get this error

Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/Users/shawnpike/anaconda/lib/python2.7/site-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
    utility.execute()
  File "/Users/shawnpike/anaconda/lib/python2.7/site-packages/django/core/management/__init__.py", line 354, in execute
    django.setup()
  File "/Users/shawnpike/anaconda/lib/python2.7/site-packages/django/__init__.py", line 21, in setup
apps.populate(settings.INSTALLED_APPS)
  File "/Users/shawnpike/anaconda/lib/python2.7/site-packages/django/apps/registry.py", line 85, in populate
    app_config = AppConfig.create(entry)
  File "/Users/shawnpike/anaconda/lib/python2.7/site-packages/django/apps/config.py", line 87, in create
    module = import_module(entry)
  File "/Users/shawnpike/anaconda/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
ImportError: No module named bootstrap3

I installed bootstrap3 in the django folder by using copy and paste and that did not work. Any help would be greatly appreciated.

Thank You!


回答1:


Just see which python version your Django environment is using with:

python -V

If it is using Python 2.7 run:

pip install django-bootstrap3

Otherwise, if your Django environment is using version Python 3 use:

pip3 install django-bootstrap3



回答2:


Try using

$pip2 install django-bootstrap3

I'm using ubuntu 14.04 and and the pip command installs packages to lib/python3.3/site-packages/ and not to lib/python2.7/site-packages/




回答3:


You have to install Requirements.txt and it will be ok.

Run this command:

pip install -r requirements.txt



回答4:


Try using:

pip install django-bootstrap3

Instead of:

pip3 install django-bootstrap3

I found out even using just plain old pip just works (even in a python3 environment )when you're using a virtual environment (I was using anaconda). For some reason pip3 doesn't work.



来源:https://stackoverflow.com/questions/25941413/importerror-no-module-named-bootstrap3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!