Python not working in command prompt? Python not working in command prompt? python python

Python not working in command prompt?


I have installed the latest Python for Win10 from Releases for Windows. Just typing py in the Command Prompt Window starts Python.

Microsoft Windows [Version 10.0.15048](c) 2017 Microsoft Corporation. All rights reserved.C:\Users\sg7>pyPython 3.6.3 (v3.6.3:2c5fed8, Oct  3 2017, 18:11:49) [MSC v.1900 64 bit (AMD64)] on win32Type "help", "copyright", "credits" or "license" for more information.>>>`enter code here`

Testing:

>>> print("hello!")hello!>>>

Please be aware that in my case Python was installed in C:\Users\sg7\AppData\Local\Programs\Python\Python36> directory

C:\Users\sg7\AppData\Local\Programs\Python\Python36>dir Volume in drive C is Windows7_OS Volume Serial Number is 1226-12D1 Directory of C:\Users\sg7\AppData\Local\Programs\Python\Python3608/05/2018  07:38 AM    <DIR>          .08/05/2018  07:38 AM    <DIR>          ..12/18/2017  09:12 AM    <DIR>          DLLs12/18/2017  09:12 AM    <DIR>          Doc12/18/2017  09:12 AM    <DIR>          include12/18/2017  09:12 AM    <DIR>          Lib12/18/2017  09:12 AM    <DIR>          libs10/03/2017  07:17 PM            30,334 LICENSE.txt10/03/2017  07:17 PM           362,094 NEWS.txt10/03/2017  07:15 PM           100,504 python.exe10/03/2017  07:12 PM            58,520 python3.dll10/03/2017  07:12 PM         3,610,776 python36.dll10/03/2017  07:15 PM            98,968 pythonw.exe08/05/2018  07:38 AM           196,096 Removescons.exe08/05/2018  07:38 AM            26,563 scons-wininst.log08/05/2018  07:38 AM    <DIR>          Scripts12/18/2017  09:12 AM    <DIR>          tcl12/18/2017  09:12 AM    <DIR>          Tools06/09/2016  11:53 PM            87,888 vcruntime140.dll               9 File(s)      4,571,743 bytes              10 Dir(s)  20,228,898,816 bytes free

When I am at C:\Users\sg7> directory level python can be invoked by typingAppData\Local\Programs\Python\Python36\python

C:\Users\samg>AppData\Local\Programs\Python\Python36\pythonPython 3.6.3 (v3.6.3:2c5fed8, Oct  3 2017, 18:11:49) [MSC v.1900 64 bit (AMD64)] on win32Type "help", "copyright", "credits" or "license" for more information.>>>

Newer Python 3.7 will be installed at: C:\Users\YourUserNameHere\AppData\Local\Programs\Python\Python37

If you wish you can add to your path environment variable:%USERPROFILE%\AppData\Local\Programs\Python\Python36


It finally worked!!!

I needed to do things to get it to work

  1. Add C:\Python27\ to the end of the PATH system variable
  2. Add C:\Python27\ to the end of the PYTHONPATH system variable

I had to add these to both for it to work.

If I added any subdirectories, it did not work for some reason.

Thank you all for your responses.


The video was very useful.

  1. Go to system properties -> Advance ( or type "system env" instart menu.)
  2. Click environment variables
  3. Edit the 'PATH' variable
  4. Add 2 new paths 'C:\Python27' and 'C:\Python27\scripts'
  5. Run cmd again and type python.

it worked for me