python 我在qresorc=provider.get_backend('ibmq_oslo ')处遇到错误

lf3rwulv  于 2022-12-28  发布在  Python
关注(0)|答案(2)|浏览(105)

我试图在量子计算机上运行一个简单的量子电路('ibmq_oslo'),但在qresorc=provider.get_backend('ibmq_oslo')处出现错误。
我验证了ibmq_oslo在我的IBMQuantum帐户的资源列表中。
下面是代码:

from qiskit import *  
circuit = QuantumCircuit(2, 2)
circuit.h(0)  
circuit.cx(0, 1)  
circuit.draw()  
simulator = Aer.get_backend('qasm_simulator')  
result = execute(circuit, backend=simulator).result()  

from qiskit .tools.visualization import plot_histogram  
plot_histogram(result.get_counts(circuit))  

from qiskit import IBMQ  
provider = IBMQ.get_provider('ibm-q')  
qresorc = provider.get_backend('ibmq_oslo')
QiskitBackendNotFoundError                Traceback (most recent call last)
Input In [14], in <cell line: 1>()
----> 1 qresorc=provider.get_backend('ibmq_oslo')

File ~\anaconda3\lib\site-packages\qiskit\providers\provider.py:55, in  
ProviderV1.get_backend(self, name, **kwargs)
     53     raise QiskitBackendNotFoundError("More than one backend matches the criteria")
     54 if not backends:
---> 55     raise QiskitBackendNotFoundError("No backend matches the criteria")
     57 return backends[0]

QiskitBackendNotFoundError: 'No backend matches the criteria'
qxsslcnc

qxsslcnc1#

后端的名称为ibm_oslo(不含q)。

jq6vz3qz

jq6vz3qz2#

  • IBM Quantum后端ibmq_16_melbourne已停用。要查看您有权访问的Quantum后端,请使用provider.backends()命令。例如,对于Open提供程序
from qiskit import IBMQ
IBMQ.load_account()
provider = IBMQ.get_provider(hub='ibm-q', group='open',
project='main')
provider.backends()

显示了可用后端的列表。例如,将视频中的行替换为

qcomp = provider.get_backend('ibmq_santiago')

将解决此问题。

相关问题