NameError: name 'python' is not defined

user13050 picture user13050 · May 31, 2013 · Viewed 114.6k times · Source

Am encountering this error in Windows Command line,done a wide search but could not get a perfect answer.Please find the error below and help in solving.

python
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'python' is not defined
>>>

Thanks in Advance,

Answer

Mark Byers picture Mark Byers · May 31, 2013

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!")