Linux command
pypy 命令
网络
复制后可按需替换文件名、目录或参数。
常用示例
Run Python script
pypy [script.py]
Start interactive mode
pypy
Run with arguments
pypy [script.py] [arg1] [arg2]
Execute code
pypy -c "[print('Hello')]"
Run a module
pypy -m [module_name]
Example
pypy -m pip install [package]
Example
pypy -O [script.py]
Example
pypy -i [script.py]
说明
PyPy is an alternative Python interpreter that uses a Just-In-Time (JIT) compiler to achieve significantly faster execution than CPython for many workloads. It is compatible with Python 2.7 and Python 3.x syntax and can run most pure-Python code without modification, offering speedups of 2-10x or more on long-running programs. The JIT compiler analyzes code at runtime and compiles frequently executed paths to machine code, so programs that loop heavily or perform repetitive computations benefit the most. PyPy also includes optimizations for memory usage through more compact object representations. Some C extension modules may not be compatible, though cffi-based extensions work well.
参数
- -c _CODE_
- Execute code.
- -m _MODULE_
- Run module.
- -i
- Interactive after script.
- -O
- Optimize mode: removes assert statements and sets __debug__ to False.
- -V, --version
- Print the PyPy version and exit.
- -u
- Unbuffered binary stdout and stderr.
- -W _arg_
- Warning control (e.g., -Wall to show all warnings).
FAQ
What is the pypy command used for?
PyPy is an alternative Python interpreter that uses a Just-In-Time (JIT) compiler to achieve significantly faster execution than CPython for many workloads. It is compatible with Python 2.7 and Python 3.x syntax and can run most pure-Python code without modification, offering speedups of 2-10x or more on long-running programs. The JIT compiler analyzes code at runtime and compiles frequently executed paths to machine code, so programs that loop heavily or perform repetitive computations benefit the most. PyPy also includes optimizations for memory usage through more compact object representations. Some C extension modules may not be compatible, though cffi-based extensions work well.
How do I run a basic pypy example?
Run `pypy [script.py]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -c _CODE_ do in pypy?
Execute code.