-bash: django-admin.py: command not found (Django

2019-09-09 03:18发布

Sorry I realize this is a very novice question: I am not yet skilled in Python. I have tried to follow a few basic django tutorials to get a simple site running. I am getting the error -bash: django-admin.py: command not found in Mac Terminal when trying to use the command django-admin.py startproject FirstBlog function.

If I try python django-admin.py startproject FirstBlog instead, terminal returns

 Traceback (most recent call last):
 File "django-admin.py", line 2, in <module>
 from django.core import management
 ImportError: No module named django.core

I have tried these commands from different directories, but still the same result. This is MacOSX 10.5.8 and Bitnami DjangoStack 1.4. I have tried to find the answer elsewhere on stackoverflow and google: people have suggested changing the path to django-admin.py. I have tried but either have written my paths incorrectly or this isn't the problem.

If more information is required I will gladly supply it. Thank you.

EDIT

I have abandoned the BitNami DjangoStack after a lot of difficulty installing the program. I have reverted to installing Django/mysql manually, which turns out to be a lot easier. Thank you.

1条回答
倾城 Initia
2楼-- · 2019-09-09 04:04

It looks like Bitnami supplies its own version of Python and that's where Django is installed so you need to make sure you are running that Python and not an Apple-supplied system Python, for example. According to the quick start guide, it looks you can either use their supplied console application which should ensure you are running with their Python:

/Applications/djangostack-1.4-0/use_djangostack

or you may be able to use the absolute path to that Python:

/Applications/djangostack-1.4-0/python/bin/python django-admin.py
查看更多
登录 后发表回答