以下代码引发错误。根据我在 qiskit github 上阅读的一些问题,它似乎与运行配置与编译配置有关,但我找不到任何其他信息可以帮助我解决此问题。
from qiskit import QuantumCircuit, IBMQ, execute
from qiskit import BasicAer as Aer
from qiskit.providers.aer import noise
ckt = QuantumCircuit(2, 2)
ckt.h(0)
ckt.cx(0, 1)
ckt.measure(0, 0)
ckt.measure(1, 1)
qsim = Aer.get_backend("qasm_simulator")
IBMQ.load_account()
provider = IBMQ.get_provider(hub="ibm-q")
qc = provider.get_backend("ibmqx2")
props = qc.properties()
coupling_map = qc.configuration().coupling_map
noise_model = noise.device.basic_device_noise_model(props)
job = execute(
ckt,
qsim,
noise_model=noise_model,
coupling_map=coupling_map,
basis_gates=noise_model.basis_gates
)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-1-2f987d65d1f7> in <module>
25 noise_model=noise_model,
26 coupling_map=coupling_map,
---> 27 basis_gates=noise_model.basis_gates
28 )
~/.venvs/qk/lib/python3.7/site-packages/qiskit/execute.py in execute(experiments, backend, basis_gates, coupling_map, backend_properties, initial_layout, seed_transpiler, optimization_level, pass_manager, qobj_id, qobj_header, shots, memory, max_credits, seed_simulator, default_qubit_los, default_meas_los, schedule_los, meas_level, meas_return, memory_slots, memory_slot_size, rep_time, parameter_binds, **run_config)
220
221 # executing the circuits on the backend and returning the job
--> 222 return backend.run(qobj, **run_config)
TypeError: run() got an unexpected keyword argument 'noise_model'
环境:
- macOS 10.14.6
- Python 3.7.3
- qiskit 0.12.0