PyPy is significantly faster when compared against the default CPython interpreter. For the most part, this interpreter functions the same way that CPython does, and most libraries will run with no issues. In my testing, PyPy was 5-10 times faster than CPython and I was able to install/use every library other than PyQt4 and Trac. For more specific benchmarks, see PyPy’s Speed Center.

  1. First we will need all the dependencies
    # Debian/Ubuntu
    sudo apt-get install \
        gcc make python-dev libffi-dev libsqlite3-dev pkg-config \
        libz-dev libbz2-dev libncurses-dev libexpat1-dev \
        libssl-dev libgc-dev python-sphinx python-greenlet mercurial
    
    # RHEL/CentOS/Fedora
    sudo yum install \
        gcc make python-devel libffi-devel lib-sqlite3-devel pkgconfig \
        zlib-devel bzip2-devel ncurses-devel expat-devel \
        openssl-devel gc-devel python-sphinx python-greenlet mercurial
  2. Change to sources directory and checkout repo
    cd /opt
    sudo hg clone https://bitbucket.org/pypy/pypy pypy
  3. Run the below commands. You can replace --opt=jit with a different optimization level
    cd pypy/pypy/goal/
    sudo python ../../rpython/bin/rpython --opt=jit targetpypystandalone.py
  4. Download and install python-setuptools
    sudo wget http://python-distribute.org/distribute_setup.py
    sudo ./pypy-c distribute_setup.py
  5. Create symlinks in /usr/bin for easier access
    sudo ln -s /opt/pypy/pypy/goal/pypy-c /usr/bin/pypy
    sudo ln -s /opt/pypy/bin/easy_install /usr/bin/easy_pypy
  • Run python scripts in PyPy with pypy script_path.py
  • Enter the PyPy shell with pypy
  • Install libraries for PyPy with easy_pypy package_name
0