Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

python command not working

31,914 views
Skip to first unread message

83nini

unread,
Apr 22, 2009, 3:20:52 AM4/22/09
to
Hi guys,

I'm new to python, i downloaded version 2.5, opened windows (vista)
command line and wrote "python", this should take me to the python
command line, but it did not! i'm getting : python is not an internal
command, external command, program, or command file.

anybody has a clue how do i solve this?
thanks in advance,
cheers,
Lina

David Cournapeau

unread,
Apr 22, 2009, 3:36:21 AM4/22/09
to 83nini, pytho...@python.org
On Wed, Apr 22, 2009 at 4:20 PM, 83nini <83n...@gmail.com> wrote:
> Hi guys,
>
> I'm new to python, i downloaded version 2.5, opened windows (vista)
> command line and wrote "python", this should take me to the python
> command line, but it did not! i'm getting : python is not an internal
> command, external command, program, or command file.

The installer does not add the path of python into your %PATH%
variable, You have to do it manually or call the full command path
(C:\Python25\python.exe or something)

David

83nini

unread,
Apr 22, 2009, 3:44:33 AM4/22/09
to

thanks for the tip, how do i add the path of python into my %PATH%?

Ben Finney

unread,
Apr 22, 2009, 3:59:11 AM4/22/09
to
83nini <83n...@gmail.com> writes:

> I'm new to python, i downloaded version 2.5

What exactly did you download? Give us the URL to the file if possible.

> opened windows (vista) command line and wrote "python"

The Python interpreter and libraries, like any other application, needs
to be installed into your system before you can start using it properly.
If you only downloaded it, then it's just bits in a file, nothing more.
Did you run the installer?

--
\ “If you're not part of the solution, you're part of the |
`\ precipitate.” —Steven Wright |
_o__) |
Ben Finney

83nini

unread,
Apr 22, 2009, 4:04:04 AM4/22/09
to

yes i did

David Cournapeau

unread,
Apr 22, 2009, 4:04:11 AM4/22/09
to 83nini, pytho...@python.org
On Wed, Apr 22, 2009 at 4:44 PM, 83nini <83n...@gmail.com> wrote:

>
> thanks for the tip, how do i add the path of python into my %PATH%?

>From the command line (and from memory, I don't use windows regularly):

set PATH=C:\python25;%PATH%

And you can set it up permanently in the advanced settings panel of
windows (the one where you set up things like amount of swap,
restoration and the likes, I don't know the exact name in English)

David

83nini

unread,
Apr 22, 2009, 4:21:22 AM4/22/09
to

thanks David, the PATH=C:\python25;%PATH% worked, but i still don't
know how to do it perminantly

Tim Golden

unread,
Apr 22, 2009, 4:31:30 AM4/22/09
to pytho...@python.org

Well you can do by selecting [System] from the Control Panel,
selecting the [Advanced] tab, the [Environment Variables]
button and then finding the PATH (user or system) and editing
it in the agonisingly small edit control which doesn't seem
to have changed since Windows 3.1. (He says, exaggerating only
a little)...

... or, I was going to say, you could run Christian Heimes'
win_add2path.py script which is in c:\python26\lib\tools.
Except that it wasn't added until python26 and uses
_winreg.ExpandEnvironmentStrings which also wasn't added
until then. (I think). But for anyone else still watching
the show...

TJG

83nini

unread,
Apr 22, 2009, 4:53:50 AM4/22/09
to
> TJG- Dölj citerad text -
>
> - Visa citerad text -

thanks guyz for the nice info

Christian Heimes

unread,
Apr 22, 2009, 5:24:21 AM4/22/09
to pytho...@python.org
David Cournapeau schrieb:

> On Wed, Apr 22, 2009 at 4:20 PM, 83nini <83n...@gmail.com> wrote:
>> Hi guys,
>>
>> I'm new to python, i downloaded version 2.5, opened windows (vista)
>> command line and wrote "python", this should take me to the python
>> command line, but it did not! i'm getting : python is not an internal
>> command, external command, program, or command file.
>
> The installer does not add the path of python into your %PATH%
> variable, You have to do it manually or call the full command path
> (C:\Python25\python.exe or something)

I highly recommend against adding C:\Python25 to your %PATH%. You can
get the same effect by adding a simple bat file to C:\Windows\System32

---
@C:\Python25\python.exe %*
---

Call it python25.bat and you are done. Apropos call, don't forget to
"call python25" in batch files. :)

Christian

83nini

unread,
Apr 22, 2009, 6:06:57 AM4/22/09
to

THIS IS REALLY KILLING ME!!!
i've been trying everything you adviced me to do, none works!!!
all i want to do is to type "python" in the cmd and get the python
command line
i want to run a server writing "python manage.py runserver" that is
not working either, of course cos "python" command is not working.
is this one of the stupid things that vista causes? or what???

83nini

unread,
Apr 22, 2009, 6:20:09 AM4/22/09
to
> is this one of the stupid things that vista causes? or what???- Dölj citerad text -

>
> - Visa citerad text -

Ok, it's not killing me anymore :P
I uninstalled python and reinstalled it again, and now it's working

David Cournapeau

unread,
Apr 22, 2009, 7:33:47 AM4/22/09
to Christian Heimes, pytho...@python.org
On Wed, Apr 22, 2009 at 6:24 PM, Christian Heimes <li...@cheimes.de> wrote:

>
> I highly recommend against adding C:\Python25 to your %PATH%. You can
> get the same effect by adding a simple bat file to C:\Windows\System32

I am curious, what's the difference ?

And does this work if you want to add it to your user PATH (not the
system one) ?

David

Christian Heimes

unread,
Apr 22, 2009, 7:43:05 AM4/22/09
to David Cournapeau, pytho...@python.org
David Cournapeau schrieb:

My way doesn't add the dlls to the search path. It allows you to have
multiple python commands at once, too. I have shortcuts for python24,
python25 and python26 on my Windows box.

Christian

David Cournapeau

unread,
Apr 22, 2009, 7:45:45 AM4/22/09
to Christian Heimes, pytho...@python.org
On Wed, Apr 22, 2009 at 8:43 PM, Christian Heimes <li...@cheimes.de> wrote:

>
> My way doesn't add the dlls to the search path. It allows you to have
> multiple python commands at once, too. I have shortcuts for python24,
> python25 and python26 on my Windows box.

Ah, thanks, that's really useful. I need this too, and did it the
"unix" way, which did not work so well for various reasons. This is
much better,

David

83nini

unread,
Apr 22, 2009, 10:23:47 AM4/22/09
to

Excuse me guys, could you please help me and tell me step by step how
to make the bat file that Christian is talking about and save it in
the System32?

I'm trying to save anything there but it's not working, though i'm the
administrator, vista keeps telling me that i can't save anything to
the system32 folder and that i have to contact my admin. in order to
fix it!

thanks for the help.
cheers,
Lina

83nini

unread,
Apr 22, 2009, 10:45:51 AM4/22/09
to

Christian,
at last i made the bat file (python25.bat) that contains the following
contents:

---
@C:\Python25\python.exe %*
---

could you tell me how to call python25 in the batch files? what batch
files do you mean? where do i find them?

Scott David Daniels

unread,
Apr 22, 2009, 11:42:19 AM4/22/09
to
83nini wrote:
> ... at last i made the bat file (python25.bat) that contains the
> following contents:
> ---
> @C:\Python25\python.exe %*
> ---
> could you tell me how to call python25 in the batch files? what batch
> files do you mean? where do i find them?

"python25.bat" or "python25.cmd" are acceptable names for that file.

Assuming you have a command window, if you enter the command,
C:\WhereEver> echo %path%
you will see a semicolon-separated list of directories. Put the
file in any of the directories on that list. You should then be
able to use the command:
C:\WhereEver> python25 <whatever>

Personally, I would use the name "python25.cmd", but that may just be
superstition on my part about the difference between .bat and .cmd
files.

--Scott David Daniels
Scott....@Acm.Org

Dave Angel

unread,
Apr 22, 2009, 8:25:12 PM4/22/09
to pythonlist
83nini wrote:
> Christian,
> at last i made the bat file (python25.bat) that contains the following
> contents:
>
> ---
> @C:\Python25\python.exe %*
> ---
>
> could you tell me how to call python25 in the batch files? what batch
> files do you mean? where do i find them?
>
>
Your original question was how to get an interactive interpreter from a
command prompt. There are at least 3 ways:

1) just specify the full path to the executable on the command line
e:\mysource\> c:\python25\python.exe

2) add c:\python25 to your PATH, either by using the SET statement, or
control panel.
then you'll be able to just use:
e:\mysource\> python

3) create a batch file in a directory on your PATH

#3 is probably the best way. You've created that batch file, now just
use it.
e:\mysource\> python25

The remark about using "call python25" refers only to the case where you
write additional batch files that use this one. Since you're not likely
to, don't worry about it yet.


If typing python25 in a command box doesn't work, then you don't have
that file on the PATH. If that's the case, tell us exactly where the
file is.


83nini

unread,
Apr 23, 2009, 3:23:41 AM4/23/09
to

Thanks a million, it worked. :D

sam.h...@gmail.com

unread,
Aug 14, 2015, 7:13:37 AM8/14/15
to
You can do it easily by adding the Python path (in my case C:\Python27) to your system PATH.

Simply go to Control Panel > System > Advanced system settings, select 'Advanced' tab, click 'Environment Variables'.

There you need to add the path to Python (C:\Python27) to the Path BOTH:
- User variables
and
- System variables
For each one click 'Edit' and paste the path (C:\Python27) at the end of the line with a ';' to separate it

Restart your shell window and it should work!

Paul McGuire

unread,
Aug 17, 2015, 1:03:01 PM8/17/15
to
On Friday, August 14, 2015 at 6:13:37 AM UTC-5, sam.h...@gmail.com wrote:
> On Wednesday, April 22, 2009 at 8:36:21 AM UTC+1, David Cournapeau wrote:
> > On Wed, Apr 22, 2009 at 4:20 PM, 83nini <83n...@gmail.com> wrote:
> > > Hi guys,
> > >
> > > I'm new to python, i downloaded version 2.5, opened windows (vista)
> > > command line and wrote "python", this should take me to the python

<snip>

>
> You can do it easily by adding the Python path (in my case C:\Python27) to your system PATH.
>

This thread is > 6 years old, OP has probably gone on to other things...
0 new messages