开源量子计算框架Qiskit安装教程

时间:2024-02-16 15:47:14

安装视频

https://www.youtube.com/watch?v=M4EkW4VwhcI

安装qiskit软件包

pip install qiskit

安装的包

Successfully installed attrs-19.3.0 certifi-2020.6.20 cffi-1.14.0 chardet-3.0.4 cryptography-3.0 dlx-1.0.4 docplex-2.15.194 fastdtw-0.3.4 fastjsonschema-2.14.4 h5py-2.10.0 idna-2.10 importlib-metadata-1.7.0 inflection-0.5.0 joblib-0.16.0 jsonschema-3.2.0 marshmallow-3.7.1 marshmallow-polyfield-5.9 more-itertools-8.4.0 nest-asyncio-1.4.0 ntlm-auth-1.5.0 ply-3.11 psutil-5.7.2 pybind11-2.5.0 pycparser-2.20 pyrsistent-0.16.0 python-constraint-1.4.0 qiskit-0.19.6 qiskit-aer-0.5.2 qiskit-aqua-0.7.3 qiskit-ibmq-provider-0.7.2 qiskit-ignis-0.3.3 qiskit-terra-0.14.2 quandl-3.5.1 requests-2.24.0 requests-ntlm-1.1.0 retworkx-0.4.0 scikit-learn-0.23.1 setuptools-49.2.0 threadpoolctl-2.1.0 urllib3-1.25.9 websockets-7.0 zipp-3.1.0

测试

新建python文档,输入

import qiskit
qiskit.__qiskit_version__

输出:

{\'qiskit-terra\': \'0.14.2\',
 \'qiskit-aer\': \'0.5.2\',
 \'qiskit-ignis\': \'0.3.3\',
 \'qiskit-ibmq-provider\': \'0.7.2\',
 \'qiskit-aqua\': \'0.7.3\',
 \'qiskit\': \'0.19.6\'}

表示安装完成。

说明文档

https://qiskit.org/documentation/
https://github.com/Qiskit

获得API token

注册账户并登录(我选择使用GitHub登录)

https://quantum-computing.ibm.com/

点击右上角的小人

可以看到并复制token

连接IBM服务器,并测试

在python文档中引入IBMQ并将复制的Token添加

from qiskit import IBMQ
IBMQ.save_account(\'Token\')
IBMQ.load_account()

输出

表示连接成功