导航

测试某个python库是否正常导入

Posted on 2023-10-11 21:27  蝈蝈俊  阅读(15)  评论(0编辑  收藏  举报

我这里的测试代码:

python -c "import magenta"

出现错误:

/Users/ghj1976/opt/anaconda3/envs/magenta/lib/python3.7/site-packages/librosa/util/decorators.py:9: NumbaDeprecationWarning: An import was requested from a module that has moved location.
Import requested from: 'numba.decorators', please update to use 'numba.core.decorators' or pin to Numba version 0.48.0. This alias will not be present in Numba version 0.50.0.
  from numba.decorators import jit as optional_jit
/Users/ghj1976/opt/anaconda3/envs/magenta/lib/python3.7/site-packages/librosa/util/decorators.py:9: NumbaDeprecationWarning: An import was requested from a module that has moved location.
Import of 'jit' requested from: 'numba.decorators', please update to use 'numba.core.decorators' or pin to Numba version 0.48.0. This alias will not be present in Numba version 0.50.0.
  from numba.decorators import jit as optional_jit

修正

pip install numba==0.48.0

再次执行

python -c "import magenta"

就没有上面错误了。

这里不能用下面命令升级到最新版本,是因为这个库内部代码我们控制不了。

pip install numba --upgrade

只能回退到一个之前的版本。