如何使用IBM-QISKit完成量子计算编程(英文)

如何使用IBM-QISKit完成量子计算编程(英文)


This project is based on the IBM QISKit tutorial on Github.
If this is the first time for you to run QISKit, please follow the following steps to install the environment:

  1. Install Anaconda 3 (Can be downloaded here)
  2. Create a new environment for running QISKit
conda create -n env_name python=3.6

Note that env_name is the name you given to this new environment. Here this line is to install the current latest version for python – version 3.6, and QISKit is only available with python 3.5 or later.

  1. Activate the newly generated environment
conda activate env_name
  1. Install QISKit package
pip install qiskit

QISKit is available on these platforms: Linux x86_64, Darwin and Win64.

  1. Install Jupyter Notebook
pip install jupyter
  1. Run Jupyter Notebook
jupyter notebook

Now we have finished all the installation. If you want to run QISKit locally, you can start the coding part now.
You can also use Qiskit to execute the code on a quantum chip. In order to do so, there is one last step left, which is to get an IBM Q token:

  1. Create an IBM account if you do not have one.
  2. Go to My Account > Advanced > API Token to get your token.
  3. Copy your token and paste it below:
# If you want to execute your code on a quantum chip:
My_token = 'XXX' # Paste your token here
from qiskit import IBMQ
IBMQ.save_account(My_token)

猜你喜欢

转载自blog.csdn.net/m0_37622530/article/details/82991041