启动Qiskit的问题

时间:2019-03-14 14:12:47

标签: python qiskit

我已经安装了Python 3.7.2,下载了anaconda和Visual Studio代码。通过pip install qiskit安装qiskit sdk 0.5.3和Python的qiskit,但是当我从https://github.com/Qiskit/qiskit-terra启动我的第一个测试程序时,我收到了一些消息,例如

> "message": "Instance of 'QuantumCircuit' has no 'h' member", 
> "message": "Instance of 'QuantumCircuit' has no 'cx' member", 
> "message": "Instance of 'QuantumCircuit' has no 'measure' member",

我做错了什么?

这是我的代码:

from qiskit import *
q = QuantumRegister(2)
c = ClassicalRegister(2)
qc = QuantumCircuit(q, c)
qc.h(q[0])
qc.cx(q[0], q[1])
qc.measure(q, c)
backend_sim = BasicAer.get_backend('qasm_simulator')
result = execute(qc, backend_sim).result()
print(result.get_counts(qc))

谢谢

1 个答案:

答案 0 :(得分:0)

这看起来和this一样。这里给出的答案是,它们可能是您的IDE产生的林特警告,它们不是您的代码错误-您的代码对我来说看起来不错!