ImportError: No module named bootstrap3

2019-06-16 04:50发布

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!

3条回答
Deceive 欺骗
2楼-- · 2019-06-16 05:03

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楼-- · 2019-06-16 05:10

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

Run this command:

pip install -r requirements.txt
查看更多
戒情不戒烟
4楼-- · 2019-06-16 05:17

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
查看更多
登录 后发表回答