Astra工具箱python库兼容问题

Traceback (most recent call last):
  File "..\astra\samples\s009_projection_matrix.py", line 42, in <module>
    W = astra.matrix.get(matrix_id)
  File "..\astra\matrix.py", line 80, in get
    return m.get(i)
  File "astra\matrix_c.pyx", line 118, in astra.matrix_c.get
  File "astra\matrix_c.pyx", line 75, in astra.matrix_c.astra_to_csr_matrix
  File "..\anaconda3\envs\astra1\lib\site-packages\numpy\__init__.py", line 324, in __getattr__
    raise AttributeError(__former_attrs__[attr])
AttributeError: module 'numpy' has no attribute 'int'.
`np.int` was a deprecated alias for the builtin `int`. To avoid this error in existing code, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations

报错信息如上

numpy在1.20版本后删除np.int

首先删除numpy然后下载1.19.5版本。

pip uninstall numpy
pip install numpy==1.19.5

报错

Installing collected packages: numpy
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
matplotlib 3.8.0 requires numpy<2,>=1.21, but you have numpy 1.19.5 which is incompatible.
scipy 1.11.3 requires numpy<1.28.0,>=1.21.6, but you have numpy 1.19.5 which is incompatible.

Successfully installed numpy-1.19.5

然后更改matplotlib和scipy到适配版本。

pip uninstall scipy

pip install scipy==1.6

pip uninstall matplotlib

pip install matplotlib==3.3.4

运行,无报错

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值