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
运行,无报错