小编Abn*_*ner的帖子

无法导入 qiskit,numpy 中的属性错误:“'numpy.random' 没有属性 'default_rng'”

我正在使用 Python 3 并且在 jupyter 中工作,当我尝试导入 qiskit 时,显示以下错误:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-2-578b7f7e9727> in <module>
----> 1 import qiskit



~\AppData\Roaming\Python\Python36\site-packages\qiskit\quantum_info\synthesis\two_qubit_decompose.py in __init__(self, unitary_matrix)
    169         # D, P = la.eig(M2)  # this can fail for certain kinds of degeneracy
    170         for i in range(100):  # FIXME: this randomized algorithm is horrendous
--> 171             state = np.random.default_rng(i)
    172             M2real = state.normal()*M2.real + state.normal()*M2.imag
    173             _, P = la.eigh(M2real)

AttributeError: module 'numpy.random' has no attribute 'default_rng'
Run Code Online (Sandbox Code Playgroud)

python import attributes numpy qiskit

4
推荐指数
2
解决办法
8264
查看次数

标签 统计

attributes ×1

import ×1

numpy ×1

python ×1

qiskit ×1