【问题标题】:IBMQProviderError: 'No provider matching the criteria'IBMQProviderError:'没有符合条件的提供者'
【发布时间】:2019-12-01 05:30:28
【问题描述】:

下面是我在 jupyter notebook 上运行的代码,我为此项目在 IBM 上创建了帐户。 请帮忙!

import qiskit as q
import numpy as np
import matplotlib
%matplotlib inline

circuit = q.QuantumCircuit(2 , 2) # 2 qubit and 2 classical bits 
#currently: (0,0)
circuit.x(0)
#now : (1,0)
circuit.cx(0 , 1)  #cnot gate , controlled NOT gate , it flips 2nd bit if 1 quibit is 1
# now : (1 , 1)
circuit.measure([0,1],[0,1])  # map quibit to bits
circuit.draw(output="mpl")  # ascii of circuit

from qiskit import IBMQ
IBMQ.save_account('MY_TOKEN_NUMBER',overwrite=True)  #save your creds
IBMQ.load_account()
#got this as output to prev line of code :
# <AccountProvider for IBMQ(hub='ibm-q', group='open', project='main')>

provider = IBMQ.get_provider(q.providers.baseprovider)

【问题讨论】:

    标签: python quantum-computing qiskit


    【解决方案1】:

    提供者从load_account() 调用中返回,然后用于选择后端。通过将字符串传递给方法provider.get_backend() 来选择后端。因此,我相信您需要的代码是:

    provider = IBMQ.load_account()
    backend = provider.get_backend('ibmq_qasm_simulator')
    

    我建议您查看README,了解有关如何加载您的帐户的更多信息。

    另外,如果您已经保存了您的帐户详细信息,一旦您不再需要重新保存它们,您只需拨打IBMQ.load_account()

    【讨论】:

      猜你喜欢
      • 2017-08-13
      • 1970-01-01
      • 2018-06-14
      • 2020-12-01
      • 2012-07-07
      • 2017-06-12
      • 1970-01-01
      • 2018-06-29
      • 2018-08-11
      相关资源
      最近更新 更多