当运行命令时,$是什么意思?

时间:2022-08-15 16:56:38

I've been learning Python, and I keep running into the $ character in online documentation. Usually it goes something like this:

我一直在学习Python,并在在线文档中不断遇到$字符。通常是这样的:

$ python ez_setup.py (Yeah, I've been trying to install setup tools)

python ez_setup美元。py(是的,我一直在尝试安装安装工具)

I'm fairly certain that this command isn't for the python IDE or console, but I've tried windows cmd and it doesn't work. Any help?

我很确定这个命令不适用于python IDE或控制台,但我尝试过windows cmd,但它不起作用。任何帮助吗?

4 个解决方案

#1


14  

As of now, Python does not implement $ in its syntax. So, it has nothing to do with Python.

到目前为止,Python并没有在其语法中实现$ $。因此,它与Python无关。

Instead, what you are seeing is the terminal prompt of a Unix-based system (Mac, Linux, etc.)

相反,您看到的是基于unix的系统(Mac、Linux等)的终端提示符。

#2


6  

When you open up command prompt in Windows, you'll see something like:

当您在Windows中打开命令提示符时,您将看到如下内容:

C:\Users\Michael0x2a\Blah> 

The $ symbol is the equivalent in Linux-based systems.

$符号在基于linux的系统中是等价的。

Whenever you see the $ sign, simply ignore it and type in the rest of the line without modification.

每当您看到$符号时,只需忽略它并在其余行中输入,而无需修改。

#3


4  

The $ is the command prompt. It is used to signify that python ez_setup.py should be run on a command line and not on a python/perl/ruby shell

$是命令提示符。它用于表示python ez_setup。py应该在命令行上运行,而不是在python/perl/ruby shell上运行。

You might also see % python ez_setup.py, which also means the same thing

您可能还会看到% python ez_setup。py,也意味着相同的东西。

#4


2  

As the two previous answers told, $ is the beginning of commandline prompt waiting for your input in Unix/Linux -systems. In Windows the similar example notation would be like

正如前面两个回答所述,$是命令行提示符的开始,等待您在Unix/Linux系统中的输入。在Windows中,类似的示例符号类似

C:\> python ez_setup.py

So you don't have to write the dollar sign. Just imagine the beginnings of Windows CMD or Powershell prompt in the beginning of line :)

所以你不需要写美元符号。想象一下Windows CMD或Powershell提示在开始时的开头:)

You can read more discussion about the history of dollar sign from Superuser.

你可以从超级用户那里看到更多关于美元符号历史的讨论。

#1


14  

As of now, Python does not implement $ in its syntax. So, it has nothing to do with Python.

到目前为止,Python并没有在其语法中实现$ $。因此,它与Python无关。

Instead, what you are seeing is the terminal prompt of a Unix-based system (Mac, Linux, etc.)

相反,您看到的是基于unix的系统(Mac、Linux等)的终端提示符。

#2


6  

When you open up command prompt in Windows, you'll see something like:

当您在Windows中打开命令提示符时,您将看到如下内容:

C:\Users\Michael0x2a\Blah> 

The $ symbol is the equivalent in Linux-based systems.

$符号在基于linux的系统中是等价的。

Whenever you see the $ sign, simply ignore it and type in the rest of the line without modification.

每当您看到$符号时,只需忽略它并在其余行中输入,而无需修改。

#3


4  

The $ is the command prompt. It is used to signify that python ez_setup.py should be run on a command line and not on a python/perl/ruby shell

$是命令提示符。它用于表示python ez_setup。py应该在命令行上运行,而不是在python/perl/ruby shell上运行。

You might also see % python ez_setup.py, which also means the same thing

您可能还会看到% python ez_setup。py,也意味着相同的东西。

#4


2  

As the two previous answers told, $ is the beginning of commandline prompt waiting for your input in Unix/Linux -systems. In Windows the similar example notation would be like

正如前面两个回答所述,$是命令行提示符的开始,等待您在Unix/Linux系统中的输入。在Windows中,类似的示例符号类似

C:\> python ez_setup.py

So you don't have to write the dollar sign. Just imagine the beginnings of Windows CMD or Powershell prompt in the beginning of line :)

所以你不需要写美元符号。想象一下Windows CMD或Powershell提示在开始时的开头:)

You can read more discussion about the history of dollar sign from Superuser.

你可以从超级用户那里看到更多关于美元符号历史的讨论。