[Django]-No matter what I do, django-admin.py is not found, even though it's in my path

5👍

The python interpreter does not look everywhere on your path to find the script. It does look everywhere for imports, but not for scripts.

Try typing django-admin.py, just django-admin.py and not python django-admin.py, and it should work. Windows should find it on the path, then execute it as a python script.

OK,

If Windows doesn’t run Python scripts (i.e. you have set your editor as the default python app), try: python -m django-admin or maybe python -m django-admin.py. The -m argument uses module mode, which checks the path.

👤wisty

5👍

I realize this is old, but came across the same issue.
On Windows, your path should include the following:

C:\Python27\;C:\Python27\Scripts

This is assuming python 2.7.3 is installed and django 1.4.3

4👍

python -mdjango-admin looks like what you’re looking for. -m tells Python to find a module on sys.path and run that module as “the main script” — which seems exactly your goal!

4👍

This python command will search syspath for the django module in question:

python -m django.bin.django-admin

0👍

I had the same problem, and python -mdjango-admin works. but i had to define PYTHONHOME & PYTHONPATH first

👤Lionel

Leave a comment