Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PYPY installation for dummies - What to do with the zip file

I'm trying to use Pypy to make my code run faster, but I don't know what to do with the zip file I downloaded from the site (I tried to read the directions but it moves too fast and I don't know what's going on). I was wondering if anyone had simple step by step instructions on how to install and use Pypy. Also, Im using Wing on Windows

like image 541
user1998665 Avatar asked Jan 22 '13 18:01

user1998665


People also ask

How do you use PyPy in Python?

For Python 2.7, it's just called pypy . For CPython, if you would like to run Python 3 from the terminal, you simply enter the command python3 . To run PyPy, simply issue the command pypy3 . Entering the pypy3 command in the terminal might return the Command 'pypy3' not found message, as shown in the next figure.


1 Answers

Unzip the zip file to a suitable location, e.g. C:\pypy then run pypy.exe from the folder to which you unzipped. There is no installation for pypy. Similarly to uninstall just delete the folder.

Running C:\pypy\pypy.exe gives you an interactive prompt, just like the one you get for running any other version of Python except it uses four chevrons >>>>.

To run a script with pypy you can explicitly name the interpreter:

C:\pypy\pypy.exe script.py

Or, if you have Python 3.3 installed on the same system, you can use the Windows Python launcher. Edit the ini file (%USERPROFILE%\AppData\Local\py.ini) with %USERPROFILE% replaced by your home folder name to contain:

[commands]
pypy=c:\pypy\pypy.exe

Then you can simply put a hashbang line at the start of any script and it will automatically run pypy when you run the script from a command line e.g. script.py, or when you click on its icon:

#!pypy
import sys
print(sys.version)

or use #!python27 to make a script run with Python 2.7, or #!python33 to make it run with Python 3.3.

like image 182
Duncan Avatar answered Nov 15 '22 03:11

Duncan