Python Forum
NameError: name 'python' is not defined - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: NameError: name 'python' is not defined (/thread-6255.html)



NameError: name 'python' is not defined - AlexCantor - Nov-12-2017


I have installed Python 3.6 and started Python. Then gave python -V command. I am getting the following error:
İmage


Python 3.6.3 (v3.6.3:2c5fed8, Oct 3 2017, 18:11:49) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> python -V
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'python' is not defined
>>>
>>>
Any suggestions for fixing this NameError please?


RE: NameError: name 'python' is not defined - metulburr - Nov-12-2017

type it in the operating system prompt, not python interpreter


RE: NameError: name 'python' is not defined - AlexCantor - Nov-12-2017

Thanks, very helpful information. Gave python -V command in DOS command window and it worked.


RE: NameError: name 'python' is not defined - cygent - Aug-14-2018

But why does it work in cmd DOS and not in python interpreter?!?
+
I am always so confused about System Variables, PATH - does anybody have a good reference where I can commit it to memory ONCE AND FOR ALL!!

Thank you Much!


RE: NameError: name 'python' is not defined - Axel_Erfurt - Aug-14-2018

in python you can use

import sys

cdPyVer = 0x600
cdSysVer = sys.version[:5]
print("%s%s" %("my python version is: ", cdSysVer))
python
Output:
my python version is: 2.7.1
python3
Output:
my python version is: 3.5.2