Python Forum
NameError: name 'python' is not defined
Thread Rating:
  • 1 Vote(s) - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
NameError: name 'python' is not defined
#1

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?
Reply
#2
type it in the operating system prompt, not python interpreter
Recommended Tutorials:
Reply
#3
Thanks, very helpful information. Gave python -V command in DOS command window and it worked.
Reply
#4
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!
Reply
#5
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
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  I'm getting a NameError: ...not defined. vonArre 2 161 Mar-24-2024, 10:25 PM
Last Post: vonArre
  Getting NameError for a function that is defined JonWayn 2 1,056 Dec-11-2022, 01:53 PM
Last Post: JonWayn
Question Help with function - encryption - messages - NameError: name 'message' is not defined MrKnd94 4 2,776 Nov-11-2022, 09:03 PM
Last Post: deanhystad
  [split] NameError: name 'csvwriter' is not defined. Did you mean: 'writer'? cathy12 4 3,201 Sep-01-2022, 07:41 PM
Last Post: deanhystad
  NameError: name ‘app_ctrl’ is not defined 3lnyn0 0 1,457 Jul-04-2022, 08:08 PM
Last Post: 3lnyn0
  NameError: name 'hash_value_x_t' is not defined Anldra12 5 1,864 May-13-2022, 03:37 PM
Last Post: deanhystad
  NameError: name 'cross_validation' is not defined tmhsa 6 13,182 Jan-17-2022, 09:53 PM
Last Post: TropicalHeat
  NameError: name “x” is not defined ... even though x is defined campjaybellson 7 14,675 Oct-20-2021, 05:39 PM
Last Post: deanhystad
  NameError: name 'Particle' is not defined in Pygame drunkenneo 4 3,299 Aug-15-2021, 06:12 PM
Last Post: bowlofred
  NameError: name 'u1' is not defined (on parser code Python) Melcu54 1 2,844 Jul-26-2021, 04:36 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020