python - 启动 qiskit 时出现问题

标签 python qiskit

我已经安装了Python 3.7.2,下载了anaconda和Visual Studio代码。通过 pip install qiskit 安装 qiskit sdk 0.5.3 和 qiskit for Python 但是当我从 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))

谢谢

最佳答案

这看起来与this有同样的问题。这里给出的答案是,它们可能是您的 IDE 生成的 linter 警告,它们不是您的代码错误 - 您的代码对我来说看起来不错!

关于python - 启动 qiskit 时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55164713/

相关文章:

python - 如何在通过 SSO 凭证连接时使用 AWS Python SDK

python - 只是 reshape 和 reshape 和获得转置之间的区别?

python - 处理用 Python 解析的 csv 文件中的额外换行符(回车符)?

python - Python 中的客户端服务器套接字编程

qiskit - Qiskit 的 RepetitionCode 类现在在哪里?

python - 如何在 qiskit 中从 np.array 创建单一门?

python - 如何在 Qiskit python 中调用 EnergyInput() 函数?

python - 如何向量化多维矩阵的 Softmax 概率

python - 无法从 Qiskit 0.7 导入 Aer