views:

1044

answers:

6

I have a Windows box with cygwin, python and django installed.

Now I want to run django-admin, but when I do I get the error:

$ django-admin.py
c:\Python26\python.exe: can't open file '/usr/bin/django-admin.py': [Errno 2] No such file or directory
+3  A: 

Hi From here

For Windows users, who do not have symlinking functionality available, you can copy django-admin.py to a location on your existing path or edit the PATH settings (under Settings - Control Panel - System - Advanced - Environment...) to point to its installed location.

hope this helps

David Santamaria
The django_admin.py is on the path.It starts with:#!c:\Python26\python.exeand bash sees and loads the file.Then the python.exe is given a bad path (cygwin path, not windows path) to the django_admin.py file. :-(
stach
You need to use the cygwin version of python if you're running under cygwin.. as far as I can tell this is unavoidable :-(
Jon Cage
A: 

Sort of sounds like the windows version of Python is trying to run instead of the cygwin one. What happens if you type this:

$ python django-admin.py

Here I'm assuming

$ which python

Finds the cygwin version of python (which will be something like /usr/bin/python).

You may also try (temporarily) uninstalling the windows version of python and use only cygwin.

Brian Neal
A: 

Help us help you. Is there a reason why you are running the windows python interpreter (c:\Python26\python.exe) as oppose to the cygwin python interpreter (/usr/bin/python.exe)? That could be your problem. So to troubleshoot that, you might consider removing the windows native interpreter or simply making sure the cygwin path is listed before the c:\Python26 path in the windows global PATH variable.

fuentesjr
A: 

Add the location of your django/bin folder (or wherever else you keep django-admin.py) to your PYTHONPATH environment variable.

Harold
A: 

Like Brian mentioned you are running the Windows version of Python which won't work with the Cygwin installation.

A word of warning. When I first started using Django, I tried installing it in Cygwin and had a variety of problems and ended up switching to the regular Windows version of Python. Unfortunately, I didn't document all my issues, but I remember some of them had to do with the database libraries. Anyway, that was a few months ago when I knew less about Django than I do now. Maybe the problems I ran into have been solved and perhaps now that I know more I could get it to work, but running Django on Cygwin does seem to be the road less traveled. Good luck. :)

+1  A: 

I just ran into the exact same problem. I've found that if you already have the windows version of python installed, it seems to get priority over the cygwin version. I solved the problem by editing /etc/profile and changed:

PATH=/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:$PATH

...to:

PATH=/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:

...which I think stops cygwin from adding the normal windows path. Once you've got that working, download django into some directory, move into that directory and type:

python setup.py install

I was having problems to begin with because I had omitted the 'python' bit at the start

Jon Cage