Back to Developer Portal
P
PyQuil
sdk
PyQuil
A Python library for quantum programming using Rigetti's Forest SDK.
Python
1.3k starsintermediate
Overview
PyQuil is Rigetti Computing's open-source Python library for quantum programming, built on top of the Quil instruction set. It provides tools for constructing quantum programs, compiling them, and executing them on Rigetti's quantum processors or the QVM simulator.
Features
Quil instruction set
Quantum compiler
QVM simulator
Quantum-classical hybrid
Forest SDK integration
Installation
pip install pyquilSample Code (Python)
from pyquil import Program
from pyquil.gates import H, CNOT, MEASURE
from pyquil import get_qc
# Create a Bell state program
p = Program()
p += H(0)
p += CNOT(0, 1)
p += MEASURE(0, 0)
p += MEASURE(1, 1)
# Run on quantum virtual machine
qc = get_qc('2q-qvm')
result = qc.run_and_measure(p, trials=1000)
print(result)Rigetti
open-source
superconducting