Python not working in command prompt?

前端 未结 20 2033
迷失自我
迷失自我 2020-11-27 15:25

I type python into the command line, but the command prompt says that python is not recognized as an internal or external command, operable program, or batch fi

20条回答
  •  無奈伤痛
    2020-11-27 16:00

    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>py
    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.
    >>>`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\Python36
    
    08/05/2018  07:38 AM              .
    08/05/2018  07:38 AM              ..
    12/18/2017  09:12 AM              DLLs
    12/18/2017  09:12 AM              Doc
    12/18/2017  09:12 AM              include
    12/18/2017  09:12 AM              Lib
    12/18/2017  09:12 AM              libs
    10/03/2017  07:17 PM            30,334 LICENSE.txt
    10/03/2017  07:17 PM           362,094 NEWS.txt
    10/03/2017  07:15 PM           100,504 python.exe
    10/03/2017  07:12 PM            58,520 python3.dll
    10/03/2017  07:12 PM         3,610,776 python36.dll
    10/03/2017  07:15 PM            98,968 pythonw.exe
    08/05/2018  07:38 AM           196,096 Removescons.exe
    08/05/2018  07:38 AM            26,563 scons-wininst.log
    08/05/2018  07:38 AM              Scripts
    12/18/2017  09:12 AM              tcl
    12/18/2017  09:12 AM              Tools
    06/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 typing AppData\Local\Programs\Python\Python36\python

    C:\Users\samg>AppData\Local\Programs\Python\Python36\python
    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.
    >>>
    

    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

提交回复
热议问题