Installing the Quantum Development Kit for the Command Line
Installing the .NET Core SDK (Windows 10, macOS, Linux)
The Quantum Development Kit uses the .NET Core SDK (2.0 or later) to make it easy to create, build, and run Q# projects from the command line.
Download and install the .NET Core SDK 2.0 or later from the .NET downloads page.
Once the .NET Core SDK is installed, run the following command in your favorite command line (e.g.: PowerShell or Bash) to download the latest templates for creating new Q# applications and libraries:
dotnet new -i Microsoft.Quantum.ProjectTemplates
You should now have the Quantum Development Kit installed and ready to use in your own applications and libraries.
Some of the samples demonstrate using the Quantum Development Kit with other programming environments, and have additional installation requirement:
- Some samples use the Node.js Package Manager (NPM) to handle user interface dependencies. NPM can be installed manually or through a package manager.
- The Python interoperability feature (currently in Windows-only preview) has been developed for the Anaconda distribution of Python 3.6. Please see the README file provided with the Python sample for more details.
Validating the Quantum Development Kit installation
In this section you will clone the quantum samples & libraries repository, and run a sample application to verify that your Q# environment is correctly installed and configured.
- Clone and open the Microsoft Quantum Developer Kit Samples and Libraries GitHub repository.
git clone https://github.com/Microsoft/Quantum.git
To continue at the command line, navigate into the newly cloned directory:
- From the terminal, run the teleport sample program:
cd Samples/src/Teleportation/ dotnet run
If the program runs and the output is similar to the following (has 8 rounds of successful teleportation with varying values True/False sent each round), your Q# environment is ready to support Q# development.
Round 0: Sent True, got True. Teleportation successful!! Round 1: Sent False, got False. Teleportation successful!! ... Round 6: Sent True, got True. Teleportation successful!! Round 7: Sent False, got False. Teleportation successful!!
In addition to these libraries and samples, the Quantum Development Kit is provided along with further libraries for non-commercial use. These libraries may be found in the Microsoft/Quantum-NC repository on GitHub.