Reputation: 511
I am trying to install Django on Windows XP. Here is what I did:
(1) Downloaded and installed Python 2.7 from
in C:\Python27
(2) Downloaded Django 1.2.1 from
(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:
What am I doing wrong?
Thanks
Upvotes: 1
Views: 2389
Reputation: 43096
Alternative method
easy_install
: http://pypi.python.org/pypi/setuptoolsC:\Python27\Scripts
to your system patheasy_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.
Upvotes: 2
Reputation: 3391
An alternate all-in-one open source Windows installer for Django that installs Apache, Python, etc.: Djangostack
Upvotes: 1
Reputation: 1165
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.
Upvotes: 1