Languages
Q#
Installing Q# on Ubuntu in TIDE
Q#
Q# (Q Sharp) is an open-source, domain-specific programming language developed by Microsoft for expressing quantum algorithms and software for quantum hardware and simulators.
Installation
Install Python 3, pip, and the Azure Quantum Development Kit (qdk) package:
apt update
apt install -y python3 python3-pip python3-venv
python3 -m pip install qdkVerification
Check that the QDK library is installed:
python3 -c "import qdk; print('Azure QDK loaded successfully')"Writing and Executing Code
Create a Python integration script named hello_quantum.py that compiles and runs Q# code:
import qsharp
qsharp_code = """
namespace QuantumApp {
open Microsoft.Quantum.Canon;
open Microsoft.Quantum.Intrinsic;
@EntryPoint()
operation SayHello() : Unit {
Message("Hello, World!");
}
}
"""
qsharp.eval(qsharp_code)Run the script using Python:
python3 hello_quantum.py