← 返回命令列表

Linux command

python2.7 命令

网络

复制后可按需替换文件名、目录或参数。

常用示例

Run Python 2.7 script

python2.7 [script.py]

Interactive mode

python2.7

Execute command

python2.7 -c "[print 'hello']"

Run module

python2.7 -m [module]

说明

python2.7 is the Python 2.7 interpreter. Python 2 reached end-of-life on January 1, 2020, and should only be used for legacy code maintenance. Use Python 3 for all new development.

参数

-c _command_
Execute command.
-m _module_
Run library module.
-i
Interactive after script.
-u
Unbuffered I/O.
-O
Optimize bytecode.
-v
Verbose imports.
-V
Print version.

FAQ

What is the python2.7 command used for?

python2.7 is the Python 2.7 interpreter. Python 2 reached end-of-life on January 1, 2020, and should only be used for legacy code maintenance. Use Python 3 for all new development.

How do I run a basic python2.7 example?

Run `python2.7 [script.py]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -c _command_ do in python2.7?

Execute command.