1

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

> "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))

谢谢

4

1 回答 1

0

This looks like the same problem as this. The answer given here is that they are linter warnings probably produced by your IDE, they are not errors with your code - your code looks good to me!

于 2019-04-01T13:13:11.963 回答