[Tutor] env var packages
eryksun
eryksun at gmail.com
Wed May 15 16:24:34 CEST 2013
On Tue, May 14, 2013 at 3:54 PM, Matthew Ngaha <chigga101 at gmail.com> wrote:
> I was instructed to get django via easy installer that was
> located in my Python/Scripts folder. it installed django to a
> different place in site-packages, where django-admin.py resides.
You appear to be using Windows, since you talk about a "Scripts"
directory (other platforms use a "bin" directory such as "/usr/bin").
easy_install *should* have created django-admin.py in the Scripts
directory. It worked for me on a fresh install of a 3.3.1, installing
Django 1.5.1. Maybe the problem is minor, and you can just copy
django-admin.py to the Scripts directory manually. If possible I'd
start over fresh. Also, I'd use pip instead of easy_install. It's
easier to uninstall with pip. If you decide to start fresh, first
install Python, distribute, and pip; then add the Scripts directory to
PATH; then run "pip install django".
Here are the scripts for installing distribute and pip:
http://python-distribute.org/distribute_setup.py
https://raw.github.com/pypa/pip/master/contrib/get-pip.py
Use a "command prompt" with elevated privileges (i.e. "Run as Administrator").
> it was specific about adding the path to the env variable, but if i already
> have python added, why do i need to add django? shouldnt it already
> be added?
When you open (execute) a file without a full or relative path, the
shell searches for the file in the directories listed in the PATH
environment variable. Additionally, if you don't specify an extension,
the cmd shell searches for the filename plus each extension listed in
PATHEXT (e.g. .EXE, .BAT). The first match becomes the fully qualified
path. Given a valid path, the shell executes the "open" command
associated with the file's extension, which is found in the system
registry under HKCR (classes root).
Specifically, when you add the Scripts directory to PATH, it allows
you to execute the files in that directory as commands, irrespective
of your current working directory. Additionally if you add .PY to the
PATHEXT environment variable, you can skip using the .py extension.
For example, you would simply run "django-admin".
One limitation with this scheme is that the file type can only be
configured for a particular executable at a time. It doesn't take into
account, for example, having multiple Python interpreters installed on
the same machine, all of which contend for the same .py extension. The
new launcher for Windows (py.exe) gets around this problem by acting
as a dispatcher based on the first line of the script (the "shebang").
The launcher is installed with 3.3 and available as a separate
download for previous versions:
https://bitbucket.org/pypa/pylauncher
https://bitbucket.org/pypa/pylauncher/raw/tip/Doc/launcher.rst
More information about the Tutor
mailing list