Difference between revisions of "PyPy"

From ArchWiki
Jump to: navigation, search
m (Changes to Installation Section)
(11 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
[[Category:Development]]
 
[[Category:Development]]
PyPy is an alternate implementation of the Python 2.7.2 interpreter. PyPy's benefits are in the area of speed, memory usage, sandboxing and stacklessness. It is compatible with Cpython with [http://pypy.org/compat.html some exceptions].
+
PyPy is an alternate implementation of the Python 2.7.2 interpreter. PyPy's benefits are in the area of speed, memory usage, sandboxing and stacklessness. It is compatible with Cpython with [http://pypy.org/compat.html some exceptions. PyPy also can be used to compile Rpython programs to C code.
 
+
 
==Installation==
 
==Installation==
Install the pypy package
+
Install the {{Pkg|pypy}} package from the [[official repositories]].
{{bc|pacman -S pypy}}
+
  
==easy_install==
+
PyPy is installed in /opt/pypy/ and the main pypy executable is /opt/pypy/pypy-c
Python libraries and programs can be installed in PyPy through easy_install. PyPy libraries are stored in a different folder then Cpython libraries.  
+
 
===easy_install Installation===
+
==Usage==
easy_install does not come with the PyPy package and must be installed manually.
+
Basic PyPy usage is done through the {{ic|pypy}} command and functions similarly to Cpython usage. Enter 
Create the /opt/pypy/site-packages/ folder.
+
{{bc|pypy -h}}
 +
to view the listing of {{ic|pypy}} options.
 +
===Interactive Interpreter===
 +
To load the pypy interactive interpreter run
 +
{{bc|pypy}}
 +
===Run Program From File===
 +
To run a python program from a file in pypy run
 +
{{bc|pypy example.py}}
 +
where example.py is the file name of the program.
 +
 
 +
==EasyInstall==
 +
Python libraries and programs can be installed in PyPy through EasyInstall. PyPy libraries are stored in a different folder then Cpython libraries.  
 +
===EasyInstall Installation===
 +
EasyInstall does not come with the PyPy package and must be installed manually.
 +
Create the /opt/pypy/site-packages/ folder which will be needed for the EasyInstall installation.
 
{{bc|sudo mkdir /opt/pypy/site-packages/}}
 
{{bc|sudo mkdir /opt/pypy/site-packages/}}
Download distribute_setup.py to the folder /opt/pypy/ and run it. distribute_setup.py will install easy_install.
+
Download distribute_setup.py to the folder /opt/pypy/ and run it. distribute_setup.py will install EasyInstall.
 
{{bc|cd /opt/pypy/
 
{{bc|cd /opt/pypy/
 
sudo wget python-distribute.org/distribute_setup.py
 
sudo wget python-distribute.org/distribute_setup.py
 
sudo pypy distribute_setup.py
 
sudo pypy distribute_setup.py
 
}}
 
}}
easy_install will be located at /opt/pypy/bin/easy_install
+
EasyInstall is located at /opt/pypy/bin/easy_install
 +
 
 +
===Installing EasyInstall Packages===
 +
To install EasyInstall package ''package_name'' into PyPy enter
 +
{{bc|sudo /opt/pypy/bin/easy_install package_name}} 
 +
Packages Will be Located at
 +
/opt/pypy/site-packages
 +
Installed libraries and applications will be at
 +
/opt/pypy/bin
 +
Programs installed through EasyInstall on PyPy can usually be ran with {{ic|/opt/pypy/bin/program_name}} where ''program_name'' is the name of the PyPy program.
  
===Installing packages==
+
===EasyInstall Package Example===
{{bc|sudo /opt/pypy/bin/easy_instal}}
+
The following will install the Lamson email framework.
 +
{{bc|sudo /opt/pypy/bin/easy_install lamson}}
 +
The following will run the framework's gen-project option
 +
{{bc|/opt/pypy/bin/lamson gen -project testproject}}
  
 
==See Also==
 
==See Also==

Revision as of 08:03, 22 December 2012

PyPy is an alternate implementation of the Python 2.7.2 interpreter. PyPy's benefits are in the area of speed, memory usage, sandboxing and stacklessness. It is compatible with Cpython with [http://pypy.org/compat.html some exceptions. PyPy also can be used to compile Rpython programs to C code.

Installation

Install the pypy package from the official repositories.

PyPy is installed in /opt/pypy/ and the main pypy executable is /opt/pypy/pypy-c

Usage

Basic PyPy usage is done through the pypy command and functions similarly to Cpython usage. Enter

pypy -h

to view the listing of pypy options.

Interactive Interpreter

To load the pypy interactive interpreter run

pypy

Run Program From File

To run a python program from a file in pypy run

pypy example.py

where example.py is the file name of the program.

EasyInstall

Python libraries and programs can be installed in PyPy through EasyInstall. PyPy libraries are stored in a different folder then Cpython libraries.

EasyInstall Installation

EasyInstall does not come with the PyPy package and must be installed manually. Create the /opt/pypy/site-packages/ folder which will be needed for the EasyInstall installation.

sudo mkdir /opt/pypy/site-packages/

Download distribute_setup.py to the folder /opt/pypy/ and run it. distribute_setup.py will install EasyInstall.

cd /opt/pypy/
sudo wget python-distribute.org/distribute_setup.py
sudo pypy distribute_setup.py

EasyInstall is located at /opt/pypy/bin/easy_install

Installing EasyInstall Packages

To install EasyInstall package package_name into PyPy enter

sudo /opt/pypy/bin/easy_install package_name

Packages Will be Located at /opt/pypy/site-packages Installed libraries and applications will be at /opt/pypy/bin Programs installed through EasyInstall on PyPy can usually be ran with /opt/pypy/bin/program_name where program_name is the name of the PyPy program.

EasyInstall Package Example

The following will install the Lamson email framework.

sudo /opt/pypy/bin/easy_install lamson

The following will run the framework's gen-project option

/opt/pypy/bin/lamson gen -project testproject

See Also

PyPy website

Python