我正在尝试设置一个简单的docker
容器来使我的代码可移植。下面是我开始使用的docker容器设置
docker run -it --name qutip_portble python:3.10.9-slim bash
一旦docker容器启动,我就安装一些包,如下所示
pip install qutip
pip install matplotlib
这两个安装成功,没有任何错误。但是,当我尝试在python中运行以下导入时
import qutip
我得到以下错误
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.10/site-packages/qutip/__init__.py", line 106, in <module>
from qutip.qobj import *
File "/usr/local/lib/python3.10/site-packages/qutip/qobj.py", line 2526, in <module>
import qutip.superop_reps as sr
File "/usr/local/lib/python3.10/site-packages/qutip/superop_reps.py", line 74, in <module>
_SINGLE_QUBIT_PAULI_BASIS = (identity(2), sigmax(), sigmay(), sigmaz())
File "/usr/local/lib/python3.10/site-packages/qutip/operators.py", line 508, in identity
return qeye(dims)
File "/usr/local/lib/python3.10/site-packages/qutip/operators.py", line 488, in qeye
return Qobj(fast_identity(size),
File "/usr/local/lib/python3.10/site-packages/qutip/fastsparse.py", line 389, in fast_identity
return fast_csr_matrix((data,ind,ptr),shape=(N,N))
File "/usr/local/lib/python3.10/site-packages/qutip/fastsparse.py", line 55, in __init__
self.format = 'csr'
AttributeError: can't set attribute 'format'
我在编写任何代码之前的import
阶段就得到了这个错误。因此,我假设这是因为一些设置问题。任何帮助将不胜感激。
1条答案
按热度按时间7gcisfzg1#
**解决方案(感谢liginity):**在设置软件包时使用以下命令显式安装
scipy
版本1.10.1