Python Forum

Full Version: NameError: name 'python' is not defined
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

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?
type it in the operating system prompt, not python interpreter
Thanks, very helpful information. Gave python -V command in DOS command window and it worked.
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!
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