Why does “pip install” inside Python raise a SyntaxError?

后端 未结 8 1030
天命终不由人
天命终不由人 2020-11-21 05:46

I\'m trying to use pip to install a package. I try to run pip install from the Python shell, but I get a SyntaxError. Why do I get this error? H

8条回答
  •  暖寄归人
    2020-11-21 06:16

    you need to type it in cmd not in the IDLE. becuse IDLE is not an command prompt if you want to install something from IDLE type this

    >>>from pip.__main__ import _main as main
    >>>main(#args splitted by space in list example:['install', 'requests'])
    

    this is calling pip like pip in terminal. The commands will be seperated by spaces that you are doing there to.

提交回复
热议问题