NameError: name python is not defined

NameError: name python is not defined

It looks like you are trying to start the Python interpreter by running the command python.

However the interpreter is already started. It is interpreting python as a name of a variable, and that name is not defined.

Try this instead and you should hopefully see that your Python installation is working as expected:

print(Hello world!)

When you run the Windows Command Prompt, and type in python, it starts the Python interpreter.

Typing it again tries to interpret python as a variable, which doesnt exist and thus wont work:

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit (Intel)] on win32
Type help, copyright, credits or license for more information.
>>> python
Traceback (most recent call last):
  File <stdin>, line 1, in <module>
NameError: name python is not defined
>>> print(interpreter has started)
interpreter has started
>>> quit() # leave the interpreter, and go back to the command line


If youre not doing this from the command line, and instead running the Python interpreter (python.exe or IDLEs shell) directly, you are not in the Windows Command Line, and python is interpreted as a variable, which you have not defined.

NameError: name python is not defined

Leave a Reply

Your email address will not be published. Required fields are marked *