简体   繁体   中英

Error when using any command on cmd with python

Every time I want to use python on cmd on Windows 10, I get this error.

Python 3.6.3 (v3.6.3:2c5fed8, Oct  3 2017, 17:26:49) [MSC v.1900 32 bit 
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> pip install pygame
  File "<stdin>", line 1
    pip install pygame
          ^
SyntaxError: invalid syntax

How is this wrong? Every other command leads to a error like this.

pip is a command to use at the Windows Command Line prompt (the C:\\ prompt), not for use in the python shell.

(So don't start Python first. Just open a command prompt and type "pip install pygame" at the C: prompt.)

If you dont have acces to the terminal you could use something like this to use pip within a script :

https://stackoverflow.com/a/15950647/8577333

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM