PyPy allows running Python code up to multiple times faster. PyPy is particularly suited for heavy “pure Python” workloads. PyPy does not significantly help for workloads heavy in Numpy array operations, for example. PyPy is slower to start, so if a program isn’t “big enough”, PyPy can be slower than standard CPython. PyPy is available for Linux, MacOS and Windows.
- download and extract PyPy3 for your operating system.
- add the pypy3 directory containing the PyPy3 executable to your PATH and reopen Terminal / Command Prompt
Install/upgrade Pip so that you can install other packages:
pypy3 -m ensurepip pypy3 -m pip install --upgrade pip setuptools wheel
Many PyPi packages can be installed with pip as usual. Note that on Windows, the appropriate version of Microsoft Visual Studio may be required to compile packages from source.
pypy3 -m pip install numpy
Some packages don’t work yet easily, particularly on Windows, where the compilers and prerequisite libraries may need to be manually built.