Python 安装和使用 pip,“SyntaxError: invalid syntax”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18744821/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 11:40:55  来源:igfitidea点击:

Installing and using pip, "SyntaxError: invalid syntax"

pythonpip

提问by Michael

I followed theseinstructions for installing pip on Windows 7. When I try to install the example package with pip install httpie(or any other package), it gives me the following error:

我按照这些说明在 Windows 7 上安装 pip。当我尝试使用pip install httpie(或任何其他包)安装示例包时,它给了我以下错误:

SyntaxError: invalid syntax

It also highlights the word install. And that's it. I am using Python 3.3.1 and used the corresponding installers in the instructions at the link above. Finally, I apologize if you consider this a duplicate, but Stack Overflow will not allow me to post on the answer in the original thread and I am getting an error message that they do not discuss.

它还突出显示了安装一词。就是这样。我使用的是 Python 3.3.1,并在上面链接的说明中使用了相应的安装程序。最后,如果您认为这是重复的,我深表歉意,但是 Stack Overflow 不允许我在原始线程中发布答案,并且我收到一条他们没有讨论的错误消息。

采纳答案by Daniel Roseman

You should type that in the command prompt, not in Python.

您应该在命令提示符中输入它,而不是在 Python 中。

回答by kindall

You're typing those commands in Python. They are not Python commands, they are shell commands. Type them in your shell!

您正在 Python 中输入这些命令。它们不是 Python 命令,而是 shell 命令。在你的 shell 中输入它们!