1

I am trying to install Django on Windows XP. Here is what I did:

(1) Downloaded and installed Python 2.7 from

http://python.org/ftp/python/2.7/python-2.7.msi

in C:\Python27


(2) Downloaded Django 1.2.1 from

http://www.djangoproject.com/download/1.2.1/tarball/


(3). After unzipping the file I placed Django's folder inside Python's site packages folder as below:

C:\Python27\Lib\site-packages\Django-1.2.1


(4). Now when I try to run "setup.py" in Django folder, I get the following error:

Traceback (most recent call last):
  File "C:\Python27\Lib\site-packages\Django-1.2.1\setup.py", line 48, in <module>
    root_dir = os.path.dirname(__file__)
NameError: name '__file__' is not defined

Screenshot can be seen below: alt text

What am I doing wrong?

Thanks

1
  • If you plan to use mysql, you're better off using python 2.5
    – chefsmart
    Aug 4, 2010 at 7:58

3 Answers 3

2

Alternative method

  1. Install easy_install : http://pypi.python.org/pypi/setuptools
  2. Add C:\Python27\Scripts to your system path
  3. Open a command line and enter easy_install django.

This will pull the latest version of Django off the PyPI website, and install it in that directory.

easy_install is definitely my favorite method for installing python modules.

0
1

Delete C:\Python27\Lib\site-packages\Django-1.2.1

Unzip tarball anywhere you want, then copy "django" subfolder from unpacked tarball into c:\Python27\lib\site-packages\, and you're done. You don't need to run setup.py actually.

If you want to install using setup.py, then open your command shell (press Win+R, type "cmd" and press Enter), change into dir you unpacked archive to (e.g. c:\archive\Django-1.2.1), and run "C:\Python27\python.exe setup.py install" without quotes.

Important note: you must run command shell with administrator privileges.

0
1

An alternate all-in-one open source Windows installer for Django that installs Apache, Python, etc.: Djangostack

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.